众所周知,有些字符串以单个字母(大写和小写)开头,然后是未知数字,最后是下划线。例如:
myStringA = 'c17898_some other characters and symbols'
myStringB = 't72_ another example string 18925 t 12 S'
myStringC = 'does not have any numbers at all'
如果字符串以所述模式开头,我需要能够删除它,只留下那些不遵循该模式的字符:
singleLetter + unknownNumberOfDigits + underscore.
如何做到最简单
您希望为此使用regular expression。以下代码将删除您指定的模式,仅当它出现在字符串
^
的开头时相关问题 更多 >
编程相关推荐