Split a string by two characters

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2011-01-09T16:36:35Z Indexed on 2011/01/09 16:54 UTC
Read the original article Hit count: 171

Filed under:
|

Hi,

Firstable i want to match if a string has the following format: $abc #xyz or $abc .xyz.

The abc and xyz mean only alphanumeric string.

If it's matched then i need to extract the first $abc and the last #xyz, all that using pure javascript and maybe regex.

The pattern is in the following order:

  1. Dollar Sign
  2. Unlimited alphanumeric string
  3. space
  4. a hash or point
  5. Unlimited alphanumeric string

Thanks in advance for any help.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex