1

I have a CSV file where each row contains an ID number and a comment:

10476195,"Very nice, thanks. I'll do more extensive research on that. :-)
"
10221912,"Why are you passing in encoded HTML into the model?  If ng-bind-html-unsafe
will just pass through the string to the browser.  So if you give it
`<br>` then this is what the browser will get - and so will print
<br> on the screen. If you want a line break then put ""<br>"" into the
string.
"

"
10237382,"I have some encoded HTML... going to write a directive myself then. Thank you. This issue can be closed I guess
"
10237600,"Great.  Here is a naive function for doing it: http://pranavrajyaguru.wordpress.com/2010/06/03/decode-html-through-javascript/.
Closing for now.
"

I need to split the records into the ID and the comment. I tried to use regular expressions like \n"\n\d{0,10}, but it didn't work well.

3
  • 2
    why not import csv, then get the specific columns you like. Commented Apr 3, 2018 at 17:20
  • If you do stick with regex, go to: regex101.com They've got a tool that shows exactly what your regex is doing live. I owe everything I've ever accomplished with regular expressions to that site. Commented Apr 3, 2018 at 17:23
  • "I tried to use regular expressions like… but it didn't work very well" is not something that can be debugged. If you want help with that approach, post your best attempt (as actual runnable code), and where it goes wrong (e.g., desired and actual output), and if it's not obvious what exactly your regex is intended to do, include an explanation. Read minimal reproducible example in the help for more. Commented Apr 3, 2018 at 17:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.