Let’s say I have these strings (each new line being a separate string):
EducationLink
BioLink
InterestsLink
And I wanted to extract the part that’s not “Link” using Javascript. How would I do this? The expected results are
Education
Bio
Interests
I tried a Regex, but I’m not very experienced with them, and it failed:
/^ (^Link) $/
Using string functions such as slice() and substr(), I only got the values to the right of the selected text, not to the left as desired.
Thanks for your help.
you can use
.replace()https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace
The thing is you CAN use regex to do this replace, but being such a simple scenario (unless there is more to it) why would you overcomplicate things?