I have a request for a bit of help, not so complicate as I think but I could not figure out:
This is my regex pattern:
/:\s*'([^:]*)'/g
(I use it without flag g by preg_match_all())
This is the string to search (usually from jqValidate):
{ messages : { required : 'This 'asdf' "asdf" field is required!', dateISO : 'This is a test...' } , rules : { dateISO : true , required : true } }
This is what I get and want to get:
array(
0 => array(
0 => : 'This 'asdf' "asdf" field is required!'
1 => : 'This is a test...'
)
1 => array(
0 => This 'asdf' "asdf" field is required!
1 => This is a test...
)
)
This is the problem:
This pattern - I spent hours to figure out as is (I´m not well practiced) - works good but only as long as I do not need a : (colon). If I use a colon in a message text between single quotes, that message does not match any more.
Mostly I tried to play around with the negation of the colon but I had no idea how to negate a group like "match all occurrences but colons, "only if" they are not lead by at least one single quote and anything between the single quote and the colon".
To make it a bit more clear what I meant above:
Example: This is a plausible use of a colon in a jqValidate message.
'Example': We probably do not use a colon together with single quotes like this.
Any 'text' here: This is a very unusual 'portion of text'!
I hope you see, what is my problem. Any useful help would be very appreciated.
Thanx in advance,
Regards Ingmar