my string is like this
coder<[email protected]>
i want [email protected] back
any help will be appreciated!
my string is like this
coder<[email protected]>
i want [email protected] back
any help will be appreciated!
var rcpt = 'coder<[email protected]>';
var addy = rcpt.match(/<([^>]*)>/)[1];
// addy = '[email protected]'
< and > is not necessary: /<([^>]*)>/ or equivalently /<(.*?)>/ or even /<(.*)>/ if we assume that this is the complete string and it contains only valid email adresses.\< or \> mess up the regex, so I routinely escape them anyway. I’ve edited the post to remove them.addy = rcpt.replace(/^.*<([^>]*)>.*$/, '$1');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<[email protected]>
", "[email protected]"));
</script>