Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Regular Expression Question


Message #1 by "Aaron sahlin" <aaronsahlin@y...> on Mon, 26 Aug 2002 19:21:38
----- Original Message -----
From: "Aaron sahlin" <aaronsahlin@y...>
To: "javascript" <javascript@p...>
Sent: Monday, August 26, 2002 7:21 PM
Subject: [javascript] Regular Expression Question


> I am pretty sure that this is a pretty simple expression, but I am new to
expressions and
> javascript.  I have a string with a value of "textIwant@5...".  I only
want the text
> preceding the '@'.  There can be n digits after the '@'.
>
> I tried an expression like this:
>
> var exp = /\@\.../;
>
> // then replace
> cellContent = rowContent[j].replace(exp, "");
>
> But this does not give me my desired results
> I get back "textIwant5858585... It stripped out the '@' but not the
numerics.
>
> Any help is much appreciated
>
try /@\d+/
this matches the '@'sign and any fllowing consecutive digits, for anything
after the '@' try /@.+/

Joe


  Return to Index