0

I'm trying to match the following strings:

PHANTOGRAM • CUT / COPY • AB$SID 3 • FITZ & THE TANTRUMS PHANTOGRAM,CUT / COPY,AB$SID 3,FITZ & THE TANTRUMS PHANTOGRAM CUT / COPY AB$SID 3 FITZ & THE TANTRUMS 

So, basically regex that matches anything between ( • |,| |\n).

I have tried things like (([^•\n])+) and positive lookahead, but geez I can't for the life of me put it together. Any advice? My hunch is I need a combination of positive lookahead and negative lookahead.

Last note: this is for the javascript environment.

Thanks for any help.

4
  • And why doesn't your way work? Commented Apr 12, 2014 at 14:30
  • Can you show your attempted code? Commented Apr 12, 2014 at 14:34
  • Match what in the following strings? The whole string? Commented Apr 12, 2014 at 14:36
  • @LeeKowalkowski, I'm trying to match the indvidual bands listed between the delimeters. Commented Apr 12, 2014 at 15:42

2 Answers 2

2

Split should help you:

var str = "PHANTOGRAM • CUT / COPY • AB$SID 3 • FITZ & THE TANTRUMS"; var res = str.split("•|,| |\n"); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! This was close but not quite there. I modified it to be a bit more robust (see my answer).
0

I ended up using something similar to laune's example that worked well:

var matches = rawText.split(new RegExp(['\n', '•'].join('|'), 'g')); 

2 Comments

Not quite the same delimiters you had in your original post, but OK.
Ah, yes, it is missing a couple but the gist is there. =)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.