我想創建一個正則表達式來生成一個匹配並剝離$和最後兩個字符,如果最後一個字符以大寫字母加數字結尾。簡單的正則表達式匹配
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來運行正則表達式。 –