Reputation: 1624
Can some one suggest regular expression for below text
Signature
text text some more text
text
...
text )
I tried Signature\n.*\)
but this only works for
Signature
text )
Basically an expression which starts with a given text, allows multiple new lines, and ends with )
.
Thanks
Upvotes: 0
Views: 167
Reputation: 170178
Flex supports negated character classes, so you could do:
/* definition section */
%%
Signature[^)]*\) { /* custom code */ }
%%
/* user subroutines */
Upvotes: 0
Reputation: 11788
You can use following regex
\bSignature[\s\S]*?[)]
This regex will first look at Signature, followed by any character which includes alphanumeric characters, \n , etc followed by )
Upvotes: 0
Reputation: 138037
The problem is that .
doesn't match new-lined by default.
A simple option is:
/signature[^)]*\)/i
[^)]*
will match all characters besides )
.
I'm not sure if you have a Dot-All flag in flex. In JavaScript the /s
flag is missing, and the common work around is:
/signature[\s\S]*?\)/i
In this case, you probably want to use a lazy quantifier, *?
, so you match until the first )
, and not the last.
Upvotes: 4