javascript regex replace help!
my string is like this
coder<coder@gmail.com>
i want coder@gmail.com
back
any help wil开发者_运维百科l be appreciated!
var rcpt = 'coder<coder@gmail.com>';
var addy = rcpt.match(/<([^>]*)>/)[1];
// addy = 'coder@gmail.com'
str.split("<")[1].split(">")[0];
Do you know http://regexlib.com/ ?
It's a site full of regex with a regex coach to try your regex.
Also you can replace manually like this:
str.remove( string.indexOf('<'), 0 )
str.remove( 0, string.indexOf('>') )
or something equals...
try str.replace
<script type="text/javascript"> document.write(str.replace("coder<coder@gmail.com> ", "coder@gmail.com")); </script>
精彩评论