Topic
  • 2 replies
  • Latest Post - ‏2013-01-25T09:32:52Z by SystemAdmin
llandale
llandale
3035 Posts

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
    3035 Posts

    Re: Regexp on strings with EOLs

    ‏2013-01-24T20:20:54Z  
    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

    Re: Regexp on strings with EOLs

    ‏2013-01-25T09:32:52Z  
    • llandale
    • ‏2013-01-24T20:20:54Z
    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?

    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