如何以"Regular Expression"搜尋特定詞句?

2012-11-21 7:39 am
如題,另含POSIX,請問在以下字串中如何搜尋 abc="任何文字" :

<xmltag1 abc="1234" def="1" ghi="567">
<xmltag2 abc="5678" def="0" ghi="qwe">
<xmltag3 abc="hijk" qwerty="on" no="234">
<xmltag4 qwerty="on" abc="regular expression" def="0" yahoo="google">
...
<xmltag100 google="yahoo" abc="bing" qwerty="456">
更新1:

單以([A-Za-z]+)無法搜到abc="regular expression"一項

回答 (1)

2012-11-21 2:29 pm
✔ 最佳答案
任何文字 = ([A-Za-z]+)

capital letters and small letters + means recur 1 or more times

2012-11-24 04:10:46 補充:
[(abc=)] or [[a][b][c][=]]
"任何文字" = ([A-Za-z]+)
1st one it works as a group, 2nd one separated


收錄日期: 2021-04-25 12:47:53
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20121120000051KK00484

檢視 Wayback Machine 備份