aimy wrote:I never knew that I can do Replace All indefinitely like that. I thought Replace All also means Replace All At Once only!
When you
Replace All, TextPad repeatedly searches for the text that matches the search expression and replaces it as specified by the replacement expression: search, replace, search, replace, and so on. Each search starts from the end of the previous replacement. In this case, that implies that once the initial part of the search expression,
select, has been used for a match, it's not available for another match on the same line. So only one match on any one line can be recognised.
aimy wrote:But it will be more appreciated if you could explain the syntax.
^(select [^,]+) ([^,]+) matches
Code: Select all
^ the beginning of a line
( start of captured text number 1
select the literal text: select
[^,]+ any non-empty text not containing commas (see below)
) end of captured text number 1
( start of captured text number 2
[^,]+ any non-empty text not containing commas (see below)
) end of captured text number 2
where
[^,]+ matches:
Code: Select all
[^,] any character except newline or comma
+ ... any non-zero number of times
We stick the matched text back together, adjusted as required:
\1, max(\2) is composed of:
Code: Select all
\1 captured text number 1
, max( the literal text: , max(
\2 captured text number 2
) the literal text: )
aimy wrote:could you please answer me about to find regular expression with specific text exclusion? And I need more explanation what does actually NEGATED EXPRESSION in TextPad is actually mean.
There is no general negation operator. There are only negated class expressions. From the help:
If the first character of a class expression is the circumflex (^), the expression matches any character not in the class. For example [^AB^] matches any character except A, B and the circumflex itself.
The best you can do in TextPad is negate a single character; you can specify that a match consists of exactly one character and that it isn't any of a specified set of characters. More modern tools have more powerful regular expression recognisers and can do better than this; for example, WildEdit (
http://www.textpad.com/products/wildedit/).
Look in TextPad's help under
Reference Information | Regular Expressions,
Reference Information | Replacement Expressions and
How to... | Find and Replace Text | Use Regular Expressions.