Reputation: 727
I have a long string, for example:
sometext~ZA÷sometext1~textsome1~text~ZA÷sometext2~textsome3~text~.......
I want a array string:
I tried pattern: ZA÷(.*?)~
It's only match ZA÷sometext~, and I've missing result. Anyone help me resolve my problem. I don't know much about regex!
EDIT: That string is just an example. It may be:
ZA÷ACDK¬ZEE÷EcZwBi3N¬ZB÷1¬ZY÷Africa¬ZC÷nyyrdizT¬ZD÷p¬ZE÷QDSLZVAl¬ZF÷0¬ZO÷0¬ZG÷1¬ZH÷1_EcZwBi3N¬ZJ÷2¬ZL÷/legue¬ZX÷00Africa......006Africa0010000000002000CAF Champion020League000¬~AA÷j3xCaVI8¬AD÷1471966200¬AB÷1¬CR÷1¬AC÷1¬CX÷Enyimba¬AX÷0¬BX÷-1¬WM÷ENY¬AE÷Enyimba¬WU÷enyimba-international¬WN÷MAM¬AF÷Mamelodi Sundowns¬WV÷mamelodi-sundowns¬AN÷y¬MW÷16|4.........
It's a complex string, which rules
Upvotes: 1
Views: 116
Reputation: 727
My friend give this pattern: (ZA÷((?!ZA÷).)*), it's work well. Thank you all for your help! :D
Upvotes: 0
Reputation: 14064
You can try the following pattern
(ZA÷.*?)ZA÷
The edit string is a sample but it doesn't have repeated ZA÷
thus cannot test it properly. But I m sure this gonna work for you, if it matches the pattern shown above.
EDIT
After getting the full string this seems to be working
.+?(?=ZA÷)
.+?
matches any character (except newline)
Quantifier:
+?
Between one and unlimited times, as few times as possible, expanding as needed [lazy]
(?=ZA÷)
Positive Lookahead - Assert that the regex below can be matched
Upvotes: 0