Wize
Member since Feb 11, 2010
- Profile: /members/5419-wize.htm
- Comments: 9
Recent Blog Comments By Wize
-
Ask Ben: Javascript String Replace Method
Posted on Mar 4, 2011 at 6:50 PM
@Sterve, Try this: nameProduct[1] = nameProduct[1].replace(/\+/g,''); and if you want a space instead of just removing the +'s try this: nameProduct[1] = nameProduct[1].replace(/\+/g,' ');... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Nov 27, 2010 at 12:02 AM
@Tom, What do you need to change the characers to and are you using Java or JavaScript?... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 27, 2010 at 1:00 PM
Thank you. That worked. I haven't used the look-ahead feature before and this is just what I needed.... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 27, 2010 at 3:20 AM
This should be really simple, but for some reason I'm not getting it. I want to match on "do" but not "doc". It's possible that there could be text after "do", but "do" can also be alone. For my test, I chose to test for it alone and I can't match "do" without matching "doc" too. I want this to mat... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 23, 2010 at 2:11 AM
@ban I'm not sure what you mean, but here is a way to show the first 12 and block out the last 4 if that's what you mean. Here is the number: 1234567890123456 Here is the replacement formula: string.replace(/(\d{12})(\d{4})/,'$1$$$$$$$$') Again, remember there are 2 $'s for every $ to output. Th... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 22, 2010 at 2:41 PM
One way to replace the first 12 digits of 16 is like this: string.replace(/\d{12}/, '$$$$$$$$$$$$$$$$$$$$$$$$') This will replace: 1234567890123456 with: $$$$$$$$$$$$3456 Since you are using a dollar sign as the replacement character, you need two for every one you will use (so there are 24 $'s.... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 17, 2010 at 2:02 PM
If this is what you're looking for, this is what it does: string.replace(/[0-9]/g,'$') Replace all numerics in the string with '$'. So 11223 would be replaced with $$$$$. I believe your initial string, string.replace(/^([0-9]+)([0-9]{4})$/g,'$'), looked for 1 or more numbers (which it can only ge... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 17, 2010 at 1:27 PM
@Ban, Try this: string.replace(/[0-9]/g,'$')... read more »
-
Ask Ben: Javascript String Replace Method
Posted on Feb 11, 2010 at 3:58 AM
I am new to regexp and have spent some time trying to come up with an expression that changes a single-quote that isn't inside a double-quote to a "#". I finally got really close, even though I don't really understand how it is working. The part I need help on is getting it to work when the very fir... read more »