Search and Replace Example - Character Sets and Match

In preparing the Advanced Seach and Replace page, I had a list thus:
{x}
Match zero or more times
{x}+
Match one or more times
{x}n:m
Match between n & m times
[x]
Optional
(x)
Group things together
x|x
OR
x x
AND
~
NOT
@x
Set a mark (x=0..9)
&xx
A byte (also &xxxx and &xxxxxxxx)
&xx
AND with xx, and compare with yy
<
True if at start of line
>
True if at end of line
<<
True if at start of paragraph
>>
True if at end of paragraph   
<<<
True if at start of text
>>>
True if at end of text
NL, $
Matches newline
\#
Any digit
?
Any alpha
*
wildcard within line
**
wildcard crossing line
I wanted to hilight these thus:.
{x} - Match zero or more times
by adding <span class="mt"> before and </span> after

So I used

Search: {'\x20-\xff'}1:6@01$
Replace: "<span class=\"mt\">"@01"</span> - "

{'\x20-\xff'} is a class including all characters from hex 20 (the Space character) to hex FF.
1:6 defines between 1 and 6 characters.
The @1 marker enables me to replace the line, omitting the (end of line character.
I ticked Start of line and Engine: Advanced

And the result was

<span class="mt">{x}</span> - Match zero or more times
<span class="mt">{x}+</span> - Match one or more times
<span class="mt">{x}n:m</span> - Match between n & m times
<span class="mt">[x]</span> - Optional
<span class="mt">(x)</span> - Group things together
<span class="mt">x|x</span> - OR
<span class="mt">x x</span> - AND
<span class="mt">~</span> - NOT
<span class="mt">@x</span> - Set a mark (x=0..9)
<span class="mt">&xx</span> - A byte (also &xxxx and &xxxxxxxx)
<span class="mt">&xx</span> - AND with xx, and compare with yy
<span class="mt"><</span> - True if at start of line
<span class="mt">></span> - True if at end of line
<span class="mt"><<</span> - True if at start of paragraph
<span class="mt">>></span> - True if at end of paragraph   
<span class="mt"><<<</span> - True if at start of text
<span class="mt">>>></span> - True if at end of text
<span class="mt">NL, $</span> - Matches newline
<span class="mt">\#</span> - Any digit
<span class="mt">?</span> - Any alpha
<span class="mt">*</span> - wildcard within line
<span class="mt">**</span> - wildcard crossing line

Other relevant pages

Top of page


Page Information

http://css.torrens.org/valid-html401-bluehttp://css.torrens.org/valid-css Document URI: http://stronged.torrens.org/man/search/examples/setmatch.html
Page first published 12th January 2018
Last modified:Wed, 30 May 2018 09:33:44 BST
© 2018 - 2018 Richard Torrens.