我想创建一个正则表达式来生成一个匹配并剥离$和最后两个字符,如果最后一个字符以大写字母加数字结尾。简单的正则表达式匹配
I'll strip off the $ and then an ending capital letter + number:
$mytestA1 --> expected output: mytest
$againD4 --> expected output: again
$something --> expected output: something
$name3 --> expected output: name3 // because there was no capital letter before the number digit
$name2P4 --> expected output: name2
我会在我的代码中检查'if'检查是否存在$,我甚至会打扰运行正则表达式。
谢谢。
是太空在'我的测试'中有一个错字?另外,你使用哪种语言? – Junuxx
描述有点不清楚 - 你能发布预期输出的例子 –
感谢您的快速回复。我加入了预期的产出。使用Java来运行正则表达式。 –