Sign in to follow this  
Followers 0
AZJIO

How do I make are not case sensitive regular expression in Unicode?

2 posts in this topic

How do I make are not case sensitive in regular expression for the local languages (Unicode)?

In other words, need to get a range of [A-Za-z] for the local language.

Need to find file names are not case sensitive, using the local language.

$sMask = 'Hello'
$sLocale = '[A-Za-z]'

MsgBox(0, 'Сообщение', __FO_UserLocale($sMask, $sLocale))

Func __FO_UserLocale($sMask, $sLocale)
    Local $i, $s, $tmp
    $sLocale=StringRegExpReplace($sMask,'[^'&$sLocale&']', '') ; получаем строку с повторами
    $tmp = StringLen($sLocale)
    For $i = 1 To $tmp
        $s = StringMid($sLocale, $i, 1)
        If $s Then ; если пустая строка, значит поиск закончился
            If StringInStr($sLocale, $s, 0, 2, $i) Then
                $sLocale = $s&StringReplace($sLocale, $s, '') ; если символ повторяется, то удаляем все, дописывая его в начало списка
            EndIf
        Else
            ExitLoop
        EndIf
    Next
    If $sLocale Then
        $tmp = StringSplit($sLocale, '')
        For $i = 1 To $tmp[0]
            $sMask = StringReplace($sMask, $tmp[$i], '['&StringUpper($tmp[$i])&StringLower($tmp[$i])&']')
        Next
    EndIf
    Return $sMask
EndFunc   ;==>__FO_UserLocale

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why is the modifier (?iu) produces an error? Why is not supported?

Edited by AZJIO

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0