c# - RegEx to replace a particular pattern v-q- to q- and v- to q- . -


i new regex.

the sentence

string ttt = "becoming <a href=\"/v-abc-q-def-ghi.aspx\">lorem ipsum</a> or <a href=\"/v-xyz.aspx\">lorem ipsum dummy " 

i want change patterns match
v-abc-q-def-ghi q-def-ghi
v-xyz q-xyz

the requirement if v- , q- present, should remove v-* ,
if has v-* should changed q-*.

var matches = regex.match(ttt, "v-*-q-*"); - 0 matches . tried few mor ethings using ([a-z])\?([a-z]) , characters, not figure out :(

kindly me this. achievable ?

is looking for?

regex.replace(ttt, @"\/(v-[^\.]*?q-|v-)", "/q-"); 

example


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -