Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    regexp search match string inside

    Help wanted · · · – – – · · ·
    3
    3
    39
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • patrickdrd
      patrickdrd last edited by patrickdrd

      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

      Alan Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @patrickdrd last edited by

        @patrickdrd

        Maybe try making your first .* into .*? to match a minimum amount, rather than a maximum amount?

        1 Reply Last reply Reply Quote 1
        • guy038
          guy038 last edited by

          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

          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors