myonlake Posted January 6, 2016 Share Posted January 6, 2016 (edited) Hey, The pcrecpp library MTA uses for regular expressions is unknown to me. The syntax is for whatever reason different from what PHP and JavaScript uses, even though as far as I know PHP uses the exact same library? Can someone lend me a hand figuring out the right syntax for this, as it seems this gives zero results when using pregFind/match. ^[^local ]function (.*?)\( Flags: mi Everywhere else: /^[^local ]function (.*?)\(/gmi local function testing1( ) end function testing2( ) -- matches on regex101, but not via MTA's pregs end addEventHandler( "test", function( ) end ) To those who don't know what this is, don't bother replying. MTA devs didn't know anything on irc today, so hoping someone knows here... Edited January 7, 2016 by Guest Link to comment
arezu Posted January 7, 2016 Share Posted January 7, 2016 Your pcre syntax does not match anything in php or javascript either. Test it here and you will see: https://regex101.com/#pcre Remove the first anchor and it will work: [^local ]function (.*?)\( (Im completely newbie at using regular expressions so don't ask me more about it) Link to comment
myonlake Posted January 7, 2016 Author Share Posted January 7, 2016 Sorry, wrong code in the first post, updated now with proper formatting. The first anchor is there for a reason, anyway (compare step count as well). https://regex101.com/r/tB1pL7/1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now