Topic
2 replies Latest Post - ‏2013-01-25T09:32:52Z by SystemAdmin
llandale
llandale
2730 Posts
ACCEPTED ANSWER

Pinned topic Regexp on strings with EOLs

‏2013-01-24T17:55:35Z |
Having trouble using repeated regexp on strings with EOLs.

I see the "^" operator means "beginning of string or line". Wiki says "\A" should mean just "beginning of string" but seems not to work in DXL.

I'm trying to find all the occurances of a pattern and it seems I must first chop up the text into individual paragraphs.

-Louie
Updated on 2013-01-25T09:32:52Z at 2013-01-25T09:32:52Z by SystemAdmin
  • llandale
    llandale
    2730 Posts
    ACCEPTED ANSWER

    Re: Regexp on strings with EOLs

    ‏2013-01-24T20:20:54Z  in response to llandale
    Solved my immediate problem, finding the location of the end of the 1st match with "end(1)"; so I don't have to break up the string. But the question remains, is there a "Beginning of string (not line)" in DXL?
    • SystemAdmin
      SystemAdmin
      3180 Posts
      ACCEPTED ANSWER

      Re: Regexp on strings with EOLs

      ‏2013-01-25T09:32:52Z  in response to llandale

      I don't think there is...I've always chopped up the processing of a string with EOLs with a loop like the following:

      Regexp aLine = regexp ".*"
      while (aLine(theString) && (theString != ""))
      {
          string theLine = theString[match 0]
          // process theLine here
          theString = theString[((end 0)+2):] // move past the newline
      }
      
      Updated on 2014-01-06T14:00:08Z at 2014-01-06T14:00:08Z by iron-man