javascript - How to extract a text using regex? -
my text
1618148163#@#jasser-pc#-#1125015374#@#anas kayyat#-#1543243035#@#anas kayyat#-#
result should be:
jasser-pc anas kayyat anas kayyat
i using :
(?<=#@#)(.+)(?=#-#)
but gives me :
jasser-pc#-#1125015374#@#anas kayyat#-#1543243035#@#anas kayyat
javascript’s regular expressions don’t support look-behind assertions (i.e. (?<=…)
, (?<!…)
), can’t use regular expression. can use this:
#@#(.+)(?=#-#)
then take matched string of first group. additionally, match little possible, make +
quantifier non-greedy using +?
.
Comments
Post a Comment