I'm having trouble writing a regexp to tag text with markup that preserves case. For example, say I want to replace
with/\b[Ca]at\b/
or<span class="topic">Cat</a>
depending on the original case of 'cat'.<span class="topic">cat</a>
The /i flag helps with the match, but unsure how to get the right case on the first letter.
I'm matching many patterns against many peices of text.
thanks!
In reply to case preservation in regexp by water
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |