Trying to parse the following text:
This is one of the [name]John’s[/name]
first tutorials.
or
Please invite [name]Steven[/name] to
the meeting.
What I need is to do a regexp in Javascript to get the name.
Doing var str = body.match(/[name](.*?)[\/name]/g); works, but how do I get just the inside of it?
Try using the “exec” method of a regular expression to get the matching groups as an array:
This could be easily extended to find all occurrences of names by using a global RegExp: