在使用正則表達式的Oracle PL/SQL代碼中,如何從一開始就以任何組合方式從特定字符中刪除所有出現的特定字符一串?usnig正則表達式,可以如何從字符串的開頭刪除某些字符的任意組合
例如,考慮字符 '+', ' - ', '=' 和 '' 在以下的輸入的開始時(空間):
' ++ -+= = - -= +ABCD EFG + XYD'
則輸出必須是:
'ABCD EFG + XYD'
我想到的解決辦法是這樣的:
1) set the starting point of the search at the beginning of the input (using ^)
2) set the ending point of the search just before the first character which is not any of the 4 characters of interest.
3) replace all spaces with empty character : REGEXP_REPLACE(' +', '')
4) replace all + with empty character
5) replace all - with empty character
6) replace all = with empty character
如果能在所有視爲一個合理的計劃,我STI我不知道上面的第2項可以用正則表達式編碼。
謝謝。
爲什麼不使用一個簡單的LTRIM函數? – Noel
我不知道LTRIM可以做同樣的事情(即修剪個別字符,不管它們出現的模式如何) - 感謝您提示Ramblin'Man – Majix