Page 1 of 1
non-greedy matching
Posted: Wed Jul 09, 2008 11:03 pm
by james deen
Can someone tell me how i can perform non-greedy matching using textpad?
for example, I'd like to change my pattern from
to
to turn it into a non-greedy pattern.
However, this doesn't appear to work.
Do i need to escape the '?' symbol?
Thanks
Posted: Thu Jul 10, 2008 9:45 am
by ben_josephs
Unfortunately, non-greedy matching isn't available in TextPad, which uses a rather old and weak regular expression recogniser. It is available in WildEdit (
http://www.textpad.com/products/wildedit/), though.
If there happen to be specific characters you don't want to occur in a match for the non-greedy part, say, for example,
< and
>, you may be able get a similar effect with this:
abc[^<>]*def
Otherwise, using TextPad regular expressions alone, you're stumped, I'm afraid.
Posted: Thu Jul 10, 2008 9:37 pm
by james deen
Thanks for your response.
That's a shame.
The example you give will work in some simple situations, but not for the cases i have in mind - i'd really need proper non-greedy matching.
I could potentially write an external tool to do the pattern matching but i wouldn't know how to select/highlight the next match.
Using DDEOPN32.EXE, i can (at best) position the cursor beside a match, but it wouldn't highlight it properly, and therefore isn't such a great solution.
Are there any tools other than DDEOPN32.EXE, or are there any other means of externally getting textpad to highlight certain characters in a file?
Thanks