Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- how to use jsl to test if a string contains only A~Z and 0~9?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 23, 2014 10:51 AM
(4487 views)

how to use jsl to test if a string contains only A~Z and 0~9?

my data shall contains only A~Z and 0~9 but when 1 or few bit flip then there is not printable characters.

many thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You can use regular expressions to check this. Create a new column that contains the following formula:

If **(**Regex**(**:Name**(**"2nd"**)**, "^[a-zA-Z0-9]+$"**)** == :Name**(**"2nd"**)**, "Yes", "No"**)**

The new column will have the value "Yes" if it is purely alphanumeric, "No" otherwise.

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You can use regular expressions to check this. Create a new column that contains the following formula:

If **(**Regex**(**:Name**(**"2nd"**)**, "^[a-zA-Z0-9]+$"**)** == :Name**(**"2nd"**)**, "Yes", "No"**)**

The new column will have the value "Yes" if it is purely alphanumeric, "No" otherwise.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

thanks for your reply, PMroz.

What ^ and +$ for?

how can I make it return 1 or 0 so that I could use it together with other comparison algorithm?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

The ^ means the start of the string, the + means to match at least one character, and the $ means the end of the string.

To return a 1 or 0 simply change Yes to 1 and No to 0:

If **(**Regex**(**:Name**(**"2nd"**)**, "^[a-zA-Z0-9]+$"**)** == :Name**(**"2nd"**)**, 1, 0**)**

There are a ton of websites out there that explain regular expressions btw.