Bonjour,
having a bit of a headache with a regex - if anyone could help, that'd be great. I'm using the following to check if a string matches the format of a MySQL function. This is proving to be a bit of a pain because of the ability to nest functions in MySQL.
I'm currently using the following:
that matches things like NOW() and DATEDIFF('1997-12-31 23:59:59','1997-12-30'), but it doesn't match DATEDIFF(NOW(),'1997-12-30')
does anyone have any idea how I might achieve this using a regex?
Furthermore, is there a way I can check whether the pattern matched the whole string, rather than just a part of it? would that just be a case of checking the match[0] argument's length compared with the string I'm checking's length?
merci
having a bit of a headache with a regex - if anyone could help, that'd be great. I'm using the following to check if a string matches the format of a MySQL function. This is proving to be a bit of a pain because of the ability to nest functions in MySQL.
I'm currently using the following:
Code:
[A-Za-z0-9_]+\([^)]*\)
that matches things like NOW() and DATEDIFF('1997-12-31 23:59:59','1997-12-30'), but it doesn't match DATEDIFF(NOW(),'1997-12-30')
does anyone have any idea how I might achieve this using a regex?
Furthermore, is there a way I can check whether the pattern matched the whole string, rather than just a part of it? would that just be a case of checking the match[0] argument's length compared with the string I'm checking's length?
merci
