I'm attempting to write a program that converts lists of terms and definitions to flashcards. My though was to use RegEx to parse the input in the following way:
term(1)-def(1)
term(2)-def(2)
term(3)-def(3)
term(4)-def(4)
term(5)-def(5)
which parses to:
terms = ["term(1)","term(2)","term(3)","term(4)","term(5)"];
definitions = ["def(1)","def(2)","def(3)","def(4)","def(5)"];
I'm very new to RegEx syntax, so I'm not sure how exactly I would do this.
Further context:
- Each line contains this format:
term
-definition
\n - I will be writing this in JavaScript so I can host the program on a website (yes, I am aware I don't need to use JS. It's just the simplest to get set up).
- The RegEx should only avoid the first
-
, as one might appear in the definition.-
will never appear in the term.