Regexp frustration!

    Dec 13 2010 | 2:40 pm
    I am trying to break down this message: media/Blackbird.m4v|Blackbird|Standard|anton|
    by using regexp but I am unable. In fact it drives me crazy! all I want is to separate each substring in the place where the | exists! any ideas plz!

    • Dec 13 2010 | 2:53 pm
      If you don't have spaces in your message (but something in your message looks like a filepath...), then fromsymbol @separator | may be enough for your needs.
    • Dec 13 2010 | 2:58 pm
      thank you Patrick, you are right the first part it is a file path and it may contain spaces. :-/ so I need a more general approach...
    • Dec 13 2010 | 3:00 pm
      But if you really want to use regular expressions, try something like this:
      regexp \| @substitute " "
    • Dec 13 2010 | 3:07 pm
      You can use [fromsymbol @separator |] even if your message contains spaces, provided it's a single symbol (which should be in any case, otherwise you'd lose every sequence of multiple spaces that might appear in the file path).
    • Dec 13 2010 | 3:14 pm
      @Andrea true it seems that [fromsymbol @separator |] is working with spaces. What do u mean single symbol? @Patrick that way [regexp \| @substitute " "] I can seperate them but I will loose track of the individual pieces if they contain spaces
    • Dec 13 2010 | 3:15 pm
      Sorry, I didn't see you needed spaces before sending the regular expression.
      This should work, using the 2nd outlet: regexp (.+)\|(.+)\|(.+)\|(.+)\|
    • Dec 13 2010 | 3:18 pm
      Super! That what I was trying to come up with but instaed of . I was using w :-) thank you both of you!
    • Dec 14 2010 | 3:06 am
      Pretty much the same as Patrick's method but a little more efficient:
      regexp ([^|]+)\|([^|]+)\|([^|]+)\|([^|]+)
      This expression captures anything-that-isn't-a-vertical-bar between other vertical bar, it's a little bit speedier than the anything-at-all method.