
Laurent_R
Veteran
/ Moderator
Dec 9, 2012, 3:05 PM
Post #2 of 5
(16203 views)
|
Re: [kukkelikuu] how to get exact match
[In reply to]
|
Can't Post
|
|
You are not saying enough about how you use your regex, but, clearly, '/^[a-z]+\_{1,}+\w+\s{0,}\(/' cannot match the expression " return ( *( int* ) MACRO_FUNCTION(" for several reasons. To start with, your regex starts with '/^[a-z]+', meaning that a match has to start with one or several lower case characters. But your expression starts with a space, not a [a-z] character, so no match. Even if you remove the '^' at the beginning of the regex, then it might start a match anywhere in the string. But it still will not match anything in your expression, because it looks for a bunch of lower case characters, followed by one of several '_', followed by a bunch of word characters. That will not match "MACRO_FUNTION" because MACRO is not in lower case. Concerning the " main_sub_function (" expression, it will again not match because of the leading space in the expression, whereas your regex says the string has to start with a [a-z] character, not a space. Again, if you remove either the leading space in the expression or the leading '^' in the regex, this will still not match because your regex declares two groups of letters separated by one or several '_', not three groups of letters semarated each by a '_' character.
|