It does not make sense to do this because ReplaceAll
and StringReplace
are different. In order to adapt ReplaceAll
first you need to check if a pattern is a string and then apply StringReplace
anyway.
So this will do:
{"abc abcb abdc"} /. s_String :> StringReplace[s, {x_ ~~ "c"} -> "0"]
String patterns are a only a small part of pattern matching framwework:
http://reference.wolfram.com/language/tutorial/Introduction-Patterns.html
http://reference.wolfram.com/language/tutorial/StringPatterns.html
p.s. you may be interested in an operator form of StringReplace
:
{"abc abcb abdc"} // StringReplace[{x_ ~~ "c"} -> "0"]
Notice it works with List
({}
) here only because StringReplace
is overloaded to thread over them. It will not work with arbitrary head:
foo["abc abcb abdc"] // StringReplace[{x_ ~~ "c"} -> "0"]