mathematica StringCases和StringReplace,Regex
程序员文章站
2022-04-01 10:25:04
...
StringCases["shdhd1.23333--12-10000/233.2 -23 123 A+12AAAA-1929", RegularExpression["[+-]?[0-9]+\.?[0-9]+"]]
{"1.23333", "-12", "-10000", "233.2", "-23", "123", "+12", "-1929"}
StringReplace["shdhd1.23333--12-10000/233.2 -23 123 A+12AAAA-1929", RegularExpression["[+-]?[0-9]+\.?[0-9]+"] -> "[ r ]"]
"shdhd[ r ]-[ r ][ r ]/[ r ] [ r ] [ r ] A[ r ]AAAA[ r ]"