欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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 ]"