LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 06:41

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ahines

    So I am relatively new to regex, but I believe I am heading in the right direction. I have a column of data where there is many different types of strings. The vast majority I do not care about. I want to extract all the rows where that column (Text) contains the string 'CASH DEP O/S'. After that string there are 2 spaces and then a MM/DD date. I've been reading and trying different combinations for awhile, but I keep getting the same error when I try to to run:

    brain.node.JRegex.cpp.147

    I've ran a filter and tried removing all the '/', replacing them with spaces to make the pattern easier, but it's a no-go. Any regex experts have any ideas, or a good source of information on syntax for spaces, exact matches AND special characters (/)?


  • 2.  RE: Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 07:03

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Is there a reason why you can't just use this?

    emit * where myText.strfind("CASH DEP O/S") > -1

    =====
    The regex parser used in LAE is based upon a package named pcre. There are full docs at http://pcre.org


  • 3.  RE: Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 07:07

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ahines

    Stonysmith- that actually worked perfectly. I didn't think to use something quite so simple, as I had been on a "learning kick" to force myself into regex. Thanks for your help...Again!


  • 4.  RE: Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 07:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ahines

    Now that I think about it though- how would I incorporate that into a split filter? I would like the remaining fields in their own specific document for later use.


  • 5.  RE: Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 08:33

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    You can set the 'PredicateExp' property of a Split node to myText.strFind("CASH DEP O/S") > -1

    Note that Lavastorm operators are case sensitive so there should be a capital 'F' in strFind()


  • 6.  RE: Split By Pattern - Regex Pattern

    Employee
    Posted 07-14-2016 08:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ahines

    That worked great. Thanks, Guys- project complete!