Answer the question
In order to leave comments, you need to log in
Regexp autocorrect
There are a lot of expressions like
< h 1 >I Księga Samuelowa 2< h 1 >
< h 1 >I Księga Samuelowa 3< h 1 >
< h 1 >I Księga Samuelowa 4< h 1 >
Should be replaced with the following
< h 1 >2< / h 1 >
< h 1 >3< / h 1 >
< h 1 >4< / h 1 >
I remember somehow pulled out with \1.
< h 1 >.*?\1< h 1 >
< h 1 >\1< / h 1 >
but it doesn't work like that =(
Help with advice please.
Answer the question
In order to leave comments, you need to log in
You would indicate what language you use, on js it looks like this:
str.replace(/(<[^>]+>).*?(\d+)<([^>]+)>/g, "$1$2< /$3>")
this is provided that you do not have a closing slash in the source text
Hmmm, can't you just remove the unnecessary piece? Like str.replace("I Księga Samuelowa", "")
Would you like to write a solution in python? PHP?
Can you suggest a solution in sed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question