Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extracting numbers between text.


Hello All,

Please help I have to extract number between text.

Example: my string contains B1234, B987HH etc I have to write a script to extract only number from the string.

String B9867HH to 9867

String B1234 to 1234

Thanks

1 Solution

Accepted Solutions
fernando_tonial
Partner - Specialist
Partner - Specialist

Hi, use the function PURGECHAR() or KEEPCHAR()

See.

PurgeChar('B9867HH','ABCDEFGHIJKLMNOPQRSTUWYVXZ') RESULT IS 9867.

or

KeepChar('B9867HH','0123456789') RESULT IS 9867.

Best Regards.

Tonial.

Don't Worry, be Qlik.

View solution in original post

6 Replies
fernando_tonial
Partner - Specialist
Partner - Specialist

Hi, use the function PURGECHAR() or KEEPCHAR()

See.

PurgeChar('B9867HH','ABCDEFGHIJKLMNOPQRSTUWYVXZ') RESULT IS 9867.

or

KeepChar('B9867HH','0123456789') RESULT IS 9867.

Best Regards.

Tonial.

Don't Worry, be Qlik.
Not applicable
Author

hi try this

purgechar ( 'a1b2c3','123' ) returns 'abc'

or try this

purgechar ( 'a1b2c3','abc' ) returns 123

Not applicable
Author

Thanks a lot

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use:

KeepChar(myCode, '0123456789')

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
saumyashah90
Specialist
Specialist

Please check QVW

Not applicable
Author

try this

keepchar ( 'B987HH','12345679' ) returns '123'