Bookmark lines regex
I need to bookmark all lines with the following:
The number in bold changes from line to line.
I’ve tried with:
/s/[0-9]/1/ but that doesn’t seem to work.
aaa/s/2593740/1/xxx bbb/s/3452352/1/xxx ccc/s/463345/1/xxx ddd/a/2236674/1/xxx eee/s/67894775679/1/xxx fff/s/8078/3/xxx
mark search regex:
(bookmarked) aaa/s/2593740/1/xxx (bookmarked) bbb/s/3452352/1/xxx (bookmarked) ccc/s/463345/1/xxx ddd/a/2236674/1/xxx (bookmarked) eee/s/67894775679/1/xxx fff/s/8078/3/xxx
[0-9] matches any one character in the set 0, 1, 2, …, 9.
[0-9]+ matches one or more of the characters in the set 0, 1, 2, …, 9.
That should explain why /s/[0-9]/1/ did not work for you.
Thanks that did the trick.Does the regex work in any program that needs a regular expression or just in Notepad ++?
it works on any similar regex engine eg php functions like preg_match_all()
but you have to make sure to escape all characters that would be interpreted as a regex pattern part instead of a character you are searching for
eg: if you use / as a regex start and end delimiter character, you have to write
\/for every slash you want to find to make regex search for the character /
so /s/[0-9]+/1/ in a php example where you use / as regex start-end delimiters it has to be rewritten to:
preg_match_all("/\/s\/[0-9]+\/1\//ms", $source_text, $matches_array);
or you can use a different delimiter character:
preg_match_all("#/s/[0-9]+/1/#ms", $source_text, $matches_array);
then if you search for the physical character # you’ll have to write