regexp search match string inside
-
hello,
I’ve got this search regexp:SRcv: ACKώΜ ΛΚΤΒ.*ΒΕ.*\*00
and 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*00
to match (i.e. return in search results):
ΒΕ63076179590000000000100000000001000000000010000101000000173610004752183ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 101002101149702ΚΒΩΒΡΤΒΓΗΓΤΖΓΤ ΒΒΕΤΖΤΧΛ ΚΥΒ. %%ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΧΥΒΕΡΒΒΡΤΒΓΕ ΗΒΒ. ΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΝΒΡΒΖΒΩΗΓΕ ΗΒΒΒΡΤΥΡΛΚΒΩΒΡΤΒΓΗΓΤΖΓΕ ΗΒΒΒΡΤΥΡΛΕ ΧΥΒ. 01000000000010112300%000000010090721135000000000011578865202103030000000000000000000000000000000000000000000000000000000000004903990000000101123000000142442510000000000101123003ΑGCF%021%%*(52272020600000000010000000000874000015Χ20210303000474000016Π20210303000873000010Π20210303000473000010Χ20210303000890059990Χ20210303000490059990Π202103030200000000010112300004880999990Χ20210303004880000175Π20210303*02950001500000001011230095010013*050109802098050980609808098*00
thanks
-
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
*00
ends each line of your file, you can simplify these regexes as, respectively,(?-s).+\KΒΕ.+
and(?-s).+?\KΒΕ.+
Best Regards,
guy038
-