Hello Experts,
it is possible to use regular expression to find 2 Cyrillic character ? Like [A-Z][A-Z] (uppercase)
Hello Experts,
it is possible to use regular expression to find 2 Cyrillic character ? Like [A-Z][A-Z] (uppercase)
Perhaps
.Pattern = "[\u0410-\u042F]{2}"
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
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...
sorry im not so close to IT stuff it is possible to find 2 cyrrillic char in this case?
Then one idea to create a function using Regular Expressions like
The you can call it from other procedure likeFunction IsValid(byval txt As String) As Boolean With Createobjct("VBScript.RegExp") .Pattern = "[\u0410-\u042F]{2}" IsValid = .test(txt) End With End Function
If IsValid(Cells(i,1)) Then 'action when true Else 'action when false End if
How can i connect your code with this one ( also your code )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
Last edited by Vixx1; 10-10-2019 at 04:55 AM.
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.
DOne, sorry
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
Missed "e", should read as
With CreateObject("VBScript.RegExp")
its working ! thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks