Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regular expression [A-Z] *

Hello,

How can I write "[A-Z] * " in Qlikview?

thank you

13 Replies
evan_kurowski
Specialist
Specialist

Stefan Wühl

Function RegExFind(iString, Pattern, Separator, IgnoreCase)

 

    for i = 0 To Found.Count - 1

        Result = Result & Found(i).Value & Separator

    next

       

    RegExFind = left(Result, len(Result)-1)

   

End Function

Hello Stefan,

I have used this thread as reference several times.  Not sure if anything changed, but I noticed copying the RegExFind() function verbatim, it was shaving off the last character on searches.  does that '-1' belong at the end where it puts the result in the function variable?  Maybe something changed on their ordinal system, but I've seen this thread for regex referenced in many other threads, and would hate for the next person to come along and have their regex experience be compromised.

Regex_macro.png

Also, question for you.  I've been trying to find out how to reference the character classes.  .NET documentation seems to indicate character classes are possible (i.e. \p{IsCyrillic}).  However, I'm not finding those same character classes working in the VBscript.  Do you know how to invoke the character classes in the VB script regex?

Really appreciate this thread btw, Thank you!  ~E

CYRUS
Contributor III
Contributor III

Thanks to share
But it gives me this error when I run:
Syntax error

Unexpected token: ')', expected one of: ',', ',', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', ...

Cleandata:
LOAD
ID,
if(RegExTest([Phone number], '^\d{3}-\d{4}'>>>>>>)<<<<<< = -1, 'Yes', 'No') as [Input phone number is valid], // Test if the phone number consists of three digits followed by a hyphen and four digits
RegExReplace([Phone number], '^(\d{3})(\d{4})', '$1-$2') as [Cleaned phone number], // Insert a hyphen between the third and fourth digit, if it is not already there
RegExReplace([Customer name], '^^(\w+)\s(\w+)', '$2, $1') as [Cleaned customer name], // Reformat the customer name in "Lastname, Firstname" format
RegExFind([Birth date] , '\d{2}-\d{2}-\d{4}', ';') as [Cleaned birth date] // Extract the birth date (a string in the form of xx-xx-xxxx) from the unclean, raw data
RESIDENT Inputdata WHERE RegExTest(ID, '^\d{3}[A-Z]{3}')
evan_kurowski
Specialist
Specialist

*Note: since the set-analysis quoting change, the wildcard set-analysis match will now be double-quotes =count( {<MyField={"*썐*"}>} MyField)

single quotes would look for the literal 3 character string asterisk-unicode char-asterisk.
CYRUS
Contributor III
Contributor III

In my case its working, here i attached my script:

WHERE
RegTelecom('$(vCalledNumber)', CalledNumberPattern ,0) AND
RegTelecom('$(vCallingNumber)', CallingNumberPattern ,0) AND
RegTelecom('$(vorigIpv4v6Addr)',origIpv4v6AddrPattern,0) AND
RegTelecom('$(vdestIpv4v6Addr)',destIpv4v6AddrPattern,0)
;

 

Function RegTelecom(iString, Pattern, IgnoreCase)

set RE = New RegExp
RE.Pattern = Pattern
RE.IgnoreCase = IgnoreCase
RegTelecom = RE.Test(iString)

End Function