I need some help with a regular expression, please help if you can
I have the following code: I am using Javascript and ASP
{In|inside|during|into|in the sphere
of} {this} {article|piece of
writing|editorial|commentary|paragraph|section}
{we} {will|desire to|wishto|want
to|resolve to|will} {tell} {you}
{more} {about|regarding|with reference
to} {the}
The desired code should look like this:
{In|inside|during|into|in the sphere
of} this {article|piece of
writing|editorial|commentary|paragraph|section}
we {will|desire to|wishto|want
to|resolve to|will} tell you
more {about|regarding|with reference
to} the
The brackets around the single words with no | should be removed like – this – we – tell you more – the in the example above.
I am thinking that the solution should be something like this
replace(/{.+?[^\|]/ig, '');
to replace the { there should not be a | in the code; {.+?[^\|] and replace { with nothing
Then if there is not a starting { to replace the } with nothing
I am not sure how to do this, and how to only remove the {} where there is no | inside without removing the content…
1 Answer