Regex remove character from capturing group/workaround -
suppose have string following
@abcd|nn12ct55|gfr
now want match
@abcd|n
and replace
@abcd n
regex matching @abcd\|[^g]
is there way remove | capturing group?
you can try regex
^@[^|]*\k\| and replace by:
" " explanation:
^marks start of string@matches @ sign[^|]*matches not pipe |\kif match being found upto previous point, \k makes current position starting point therefore previous part wont replaced\|matches pipe --> pipe going replaced
Comments
Post a Comment