+ Reply to Thread
Results 1 to 12 of 12

Regular expression with Cyrillic characters

Hybrid View

  1. #1
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Regular expression with Cyrillic characters

    Hello Experts,
    it is possible to use regular expression to find 2 Cyrillic character ? Like [A-Z][A-Z] (uppercase)

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regular expression with Cyrillic characters

    Perhaps
    .Pattern = "[\u0410-\u042F]{2}"

  3. #3
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    Jindon you'are solving all my problems in excel heh, real forum guru, its connected to last task but ive got 6 files that contain cyrillic characters
    (Not Cells(i, 4).Text Like "*[A-Z]*")) -< this [A-Z] need to replace for cyrillic chracters, how to use this pattern with that

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regular expression with Cyrillic characters

    It is not a Regular Expression. It is just a Like operator and the character set with wild card.

    You said "Regular Expression", that is totally different object...

  5. #5
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    sorry im not so close to IT stuff it is possible to find 2 cyrrillic char in this case?

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regular expression with Cyrillic characters

    Then one idea to create a function using Regular Expressions like
    Function IsValid(byval txt As String) As Boolean
         With Createobjct("VBScript.RegExp")
            .Pattern = "[\u0410-\u042F]{2}"
            IsValid = .test(txt)
        End With
    End Function
    The you can call it from other procedure like
    If IsValid(Cells(i,1)) Then
        'action when true
    Else
        'action when false
    End if

  7. #7
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    Sub test()
        Dim i As Long
        For i = 1 To Range("c" & Rows.Count).End(xlUp).Row
            Rows(i).Hidden = ((Cells(i, 3).Text Like "*[A-Z][A-Z]*") * (Cells(i, 4).Text Like "*[A-Z][A-Z]*")) + _
                        ((Not Cells(i, 3).Text Like "*[A-Z][A-Z]*") * (Not Cells(i, 4).Text Like "*[A-Z][A-Z]*"))
        Next
    End Sub
    How can i connect your code with this one ( also your code )
    Last edited by Vixx1; 10-10-2019 at 04:55 AM.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regular expression with Cyrillic characters

    Thanks for the code tags.
    Can not test, so not really sure
    Sub test()
        Dim i As Long
        For i = 1 To Range("c" & Rows.Count).End(xlUp).Row
            Rows(i).Hidden = (IsValid(Cells(i, 3).Text) * IsValid(Cells(i, 4).Text)) + _
                        (Not IsValid(Cells(i, 3).Text) * Not IsValid(Cells(i, 4).Text))
        Next
    End Sub
    Last edited by jindon; 10-10-2019 at 05:02 AM.

  9. #9
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    DOne, sorry

  10. #10
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    Sub or function not defined in code it look like this ( i made few cosmetics changes up to my file ) :
    Function IsValid(ByVal txt As String) As Boolean
         With Createobjct("VBScript.RegExp")
            .Pattern = "[\u0410-\u042F]{2}"
            IsValid = .test(txt)
        End With
    End Function
    
    Sub test()
        Dim i As Long
        For i = 1 To Range("c" & Rows.Count).End(xlUp).Row
            Rows(i).Hidden = ((Cells(i, 4).Text Like "*[A-Z][A-Z]*") * (IsValid(Cells(i, 6).Text))) + _
                        ((Not Cells(i, 4).Text Like "*[A-Z][A-Z]*") * (Not IsValid(Cells(i, 6).Text)))
        Next
    End Sub

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regular expression with Cyrillic characters

    Missed "e", should read as
         With CreateObject("VBScript.RegExp")

  12. #12
    Registered User
    Join Date
    08-14-2019
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    36

    Re: Regular expression with Cyrillic characters

    its working ! thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help with VBA Regular Expression
    By noboffinme in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-13-2019, 12:16 AM
  2. Regular Expression Help
    By wwconslt in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-18-2017, 10:33 PM
  3. [SOLVED] Regular Expression (lookbehind)
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2015, 09:53 AM
  4. [SOLVED] Regular expression
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2015, 10:59 PM
  5. Regular expression
    By Gourav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2014, 03:23 PM
  6. [SOLVED] Regular Expression
    By Kvramana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 05:32 AM
  7. Cyrillic characters in excel
    By cyrilastin in forum Excel General
    Replies: 2
    Last Post: 05-23-2006, 01:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1