javascript - Losing the expression in debugger -


i trying regular expression remove junk on string getting service. string has phone data want remove. example string "en-us; droid4 build/9.8.2o-72_vzw-18" . first task drop "build/" end of string or end of word (not sure better in scenario).

i ended with:

var deviceregexpr = new regexp("\b(build\/\s*)"); 

first off, not sure if best way accomplish this. but, when looking @ chrome debugger tools regexp value showing "/(build/s*)/" . cant figure out happening \b ?

thanks in advance help.

this string#replace(regex, repacement) should work:

var repl = "en-us; droid4 build/9.8.2o-72_vzw-18".replace(/\s*\bbuild\/.*$/, "");  //=> en-us; droid4 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -