0

I am attempting to isolate all numbers and letters that are not 9 in my example below.

RHB|1|9

After some research I feel like I am getting close, though the "|" seem to make things difficult when using Regex. Is there a way to use a single character placeholder to count out the "|1|" then search for all other numbers and letters?

  • The | is a logical OR. The token [^9] matches any character NOT the digit 9. – Ron Maupin Aug 1 '16 at 23:43
  • That helps! How would sequentially check for just numbers after that? Also, is there a way to check for "|" in "RHB|1|9"? – BlainPLD Aug 2 '16 at 0:08
  • To check for a character special to RegEx, you must escape the character with backslash. For example, to check for a backslash, you must use `\\`. – Ron Maupin Aug 2 '16 at 0:10
  • So, to find "|" I use ` | `? – BlainPLD Aug 2 '16 at 0:16
  • You would use \|. – Ron Maupin Aug 2 '16 at 0:17
1

To match all letters and numbers except the number 9 then you do [a-zA-Z0-8].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.