Jump to content

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


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...