regexp search match string inside
-
hello,
I’ve got this search regexp:SRcv: ACKώΜ ΛΚΤΒ.*ΒΕ.*\*00and I would like to match the text that is between “BE” and “*00”
for example in the string:
SRcv: ACKώΜ ΛΚΤΒ100540ΛΚΤΒ101938145503101028Ξ001Β10ΒΕ63076179590000000000100000000001000000000010000101000000173610004752183ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 101002101149702ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 01000000000010112300%000000010090721135000000000011578865202103030000000000000000000000000000000000000000000000000000000000004903990000000101123000000142442510000000000101123003ΑGCF%021%%*(52272020600000000010000000000874000015Χ20210303000474000016Π20210303000873000010Π20210303000473000010Χ20210303000890059990Χ20210303000490059990Π202103030200000000010112300004880999990Χ20210303004880000175Π20210303*02950001500000001011230095010013*050109802098050980609808098*00to match (i.e. return in search results):
ΒΕ63076179590000000000100000000001000000000010000101000000173610004752183ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 101002101149702ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 01000000000010112300%000000010090721135000000000011578865202103030000000000000000000000000000000000000000000000000000000000004903990000000101123000000142442510000000000101123003ΑGCF%021%%*(52272020600000000010000000000874000015Χ20210303000474000016Π20210303000873000010Π20210303000473000010Χ20210303000890059990Χ20210303000490059990Π202103030200000000010112300004880999990Χ20210303004880000175Π20210303*02950001500000001011230095010013*050109802098050980609808098*00thanks
-
Maybe try making your first
.*into.*?to match a minimum amount, rather than a maximum amount? -
Hi, @patrickdrd, @alan-kilborn and All
-
To select from the last string
ΒΕof the lines ( Greek letters ! ) till the string*00, use the regex(?-s).+\KΒΕ.+\*00 -
To select from the first string
ΒΕof the lines ( Greek letters ! ) till the string*00, use the regex(?-s).+?\KΒΕ.+\*00
Note that, if the string
*00ends each line of your file, you can simplify these regexes as, respectively,(?-s).+\KΒΕ.+and(?-s).+?\KΒΕ.+Best Regards,
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login