I need to get -0.33 from the string below with RegExMatch. The Chinese characters make it difficult for me to get it working. Please help!
<td>每股收益:<span>-0.33</span></td>
Thank you for your help!
RegExMatch() with foreign language
- oldbrother
- Posts: 275
- Joined: 23 Oct 2013, 05:08
Re: RegExMatch() with foreign language
What is the search criteria you want to use?
If you are just looking for a number, then the language of the other characters won't matter. https://regex101.com/r/r3Yzor/1
I assume you are looking for <td>每股收益 followed by the next number? https://regex101.com/r/GcGjf0/1
You would need to save your script as UTF-8 with BOM.
If you are just looking for a number, then the language of the other characters won't matter. https://regex101.com/r/r3Yzor/1
I assume you are looking for <td>每股收益 followed by the next number? https://regex101.com/r/GcGjf0/1
You would need to save your script as UTF-8 with BOM.
Code: Select all
#Requires AutoHotkey v1.1.33
data := "0a9sd<td>每股blah益:<span>-0.33</span></td>y[ufho;in`n"
. "ioaweu8hgfsdliuh<td>每股收益:<span>-0.33</span></td>oa8we9fsyhdawer-f6<td>每blah收益:<span>-0.33</span></td>sy89phio"
. "awer-f6<td>每blah收益:<span>-0.33</span></td>sy89phio"
RegExMatch(data, "<td>每股收益:.+?\K-?\d\.\d{2}", var)
MsgBox % var
Re: RegExMatch() with foreign language
Another one:
Code: Select all
RegExMatch(data, "<td>每股收益:\h*<span>(.+?)</span>", var)
MsgBox % var1
- oldbrother
- Posts: 275
- Joined: 23 Oct 2013, 05:08
Re: RegExMatch() with foreign language
Thank you all! It works. Have a nice weekend!