regex:all_text_not_containing
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
regex:all_text_not_containing [2025/05/27 07:44] – peter | regex:all_text_not_containing [2025/05/27 07:55] (current) – peter | ||
---|---|---|---|
Line 27: | Line 27: | ||
</ | </ | ||
- | Or a negative look-behind assertion: | + | Or, use a negative look-behind assertion: |
<code bash> | <code bash> | ||
Line 33: | Line 33: | ||
</ | </ | ||
- | Or just plain old character sets and alternations: | + | Or, use plain old character sets and alternations: |
<code bash> | <code bash> | ||
Line 41: | Line 41: | ||
---- | ---- | ||
+ | ===== Match strings that do not end in particular sequence ===== | ||
+ | |||
+ | Use a negative lookbehind assertion: | ||
+ | |||
+ | <code bash> | ||
+ | ^[/ | ||
+ | </ | ||
+ | |||
+ | or, use a lookahead: | ||
+ | |||
+ | <code bash> | ||
+ | ^(? | ||
+ | </ | ||
+ | |||
+ | or, another use of a lookahead assertion: | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** | ||
+ | |||
+ | * **(** - Start a group for the purposes of repeating. | ||
+ | * **(? | ||
+ | * **[/\w.-]** - The pattern for matching a URL character. | ||
+ | * **)+** - Repeat the group. | ||
+ | |||
+ | |||
+ | To force it to match the entire string, anchor the entire pattern with **^** at the start and **$** at the end; otherwise it is free to only match a portion of the string. With this change, it becomes: | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | https:// | ||
regex/all_text_not_containing.1748331848.txt.gz · Last modified: 2025/05/27 07:44 by peter