I want to change a string which start 'a' and end 'n'.
For example: "action" I want to replace 'ctio' and all starting 'a' and finishing 'n' with ''.
How can do it?
I want to change a string which start 'a' and end 'n'.
For example: "action" I want to replace 'ctio' and all starting 'a' and finishing 'n' with ''.
How can do it?
in Javascript:
var substitute = "\"";
var text = "action";
var text = text.replace(/\b(a)([a-z]+?)(n)\b/gim,"$1" + substitute + "$3");
// result = a"n ... if what you really want is a double quote here
try this following
str.replace(/\ba(\w+)n\b/igm,'');
to the question in the comment use th following comment
var sub = "hello";
str.replace(/(<)(\w+)(")/igm,"$1" + sub + "$3");