Multi Line Regex
Posted: Sun Oct 14, 2012 4:07 pm
Textpad claims to support mulitline regular expressions.
But it doesn't really. Not when there's an undetermined number of lines.
A simple example is that you might want to remove long comments from your javascript. Comments like this:
/* Derive random numbers
If the array has 438 elements, we need to generate random numbers
from 0 to 437. The Math.random method does just that. */
First we would search for /* with the asterisk escaped: /\*
Then one or more characters that are not asterisk: [^\*]{1,}
Then finally asterisk slash: \*/
The full expression is: /\*[^\*]{1,}\*/
In UltraEdit this exact expression works instantly using UltraEdit's Perl Regex syntax.
But for years I've been trying to find a way to make it work in Textpad, but it just doesn't.
Almost exactly the same syntax works in Microsoft Word:
/\*[!\*]{1,}\*/ (the only difference is that ! replaces ^ as the negator)
It really should work in TextEdit.
A few Google searches show that there's a few frustrated Textpad users who wish that it would do what I'm asking.
Please enhance TextEdit so that mulitiline regexes are possible.
To be quite precise, it's not an enhancement request. It's a bug report.
If Textpad claims to be able to do mulitline regex, and it can't then that's a bug. Please fix.
But it doesn't really. Not when there's an undetermined number of lines.
A simple example is that you might want to remove long comments from your javascript. Comments like this:
/* Derive random numbers
If the array has 438 elements, we need to generate random numbers
from 0 to 437. The Math.random method does just that. */
First we would search for /* with the asterisk escaped: /\*
Then one or more characters that are not asterisk: [^\*]{1,}
Then finally asterisk slash: \*/
The full expression is: /\*[^\*]{1,}\*/
In UltraEdit this exact expression works instantly using UltraEdit's Perl Regex syntax.
But for years I've been trying to find a way to make it work in Textpad, but it just doesn't.
Almost exactly the same syntax works in Microsoft Word:
/\*[!\*]{1,}\*/ (the only difference is that ! replaces ^ as the negator)
It really should work in TextEdit.
A few Google searches show that there's a few frustrated Textpad users who wish that it would do what I'm asking.
Please enhance TextEdit so that mulitiline regexes are possible.
To be quite precise, it's not an enhancement request. It's a bug report.
If Textpad claims to be able to do mulitline regex, and it can't then that's a bug. Please fix.