Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular expressions match Asian characters
#1
Hi,

The following regular expressions give different results in QM and Powershell

How do I express Asian characters with regular expressions?

No effect:
str pattern="\$[a-zA-Z_][a-zA-Z0-9\u4e00-\u9fa5]*"
 
Code:
Copy      Help
$s=@'
function fn ($sp1姓名, $ip2年龄)
{
    "hello, "
}
'@
$m = [regex]"\$[a-zA-Z_][^\W]*"
$m.Matches($s).Value



Macro Macro24
Code:
Copy      Help
_s=
;function fn ($sp1姓名, $ip2年龄) {
;,"hello, "
;}

str pattern="\$[a-zA-Z_][^\W]*"
str d
ARRAY(str) a
findrx(_s pattern 0 4 a)
out a
#2
Not supported in QM. More info here at the end: https://www.quickmacros.com/help/RegExp/IDP_PCRE.html
#3
this works for your example
 
Code:
Copy      Help
_s=
;function fn ($sp1姓名, $ip2年龄) {
;,"hello, "
;}

str pattern="\$[a-zA-Z_][a-zA-Z0-9\x80-\xff]+"
str d
ARRAY(str) a
findrx(_s pattern 0 4 a)
out a
for int'i 0 a.len
,out a[0 i]
#4
worked well, thanks so much


Forum Jump:


Users browsing this thread: 1 Guest(s)