1 command , 2 replaces
var newString = oldString.replace(/X/,-).replace(/Y/,)
On 3/7/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote:
hello!
I'm experimenting with regular expressions, and i would like to replace in a
string some special characters by a - minus sign, and others by just
hello!
I'm experimenting with regular expressions, and i would like to replace in a
string some special characters by a - minus sign, and others by just removing
it.
Do i need ot make two regex.replace(), or is it possible to have both in one
command?
thank you very much for your time!
Ah, the jQuery way, of course :)
Thanks Jake
-Original Message-
From: Ⓙⓐⓚⓔ [mailto:[EMAIL PROTECTED]
Sent: jeudi 8 mars 2007 0:48
To: [EMAIL PROTECTED]; jQuery Discussion.
Subject: Re: [jQuery] regular expressions
1 command , 2 replaces
var newString = oldString.replace(/X
Quick tut:
Just typing something out, eg, /abcd/ would replace anything that contained
the exact string abcd, case sensative. If you do /[abcd]/, notice the
brackets, it will select the letter a, the letter b, etc. For ranges you
can do something like /[a-d]/, which would do the same as
and while we're at it,
you can use a function as the second parameter!
oldString.replace(/[bad or dashable chars]+/g,
function (str) {
return (str.match(/^[dashable chars]$/) ? - : )
}
)
1 command 1 replace!
On 3/7/07,
Discussion.
Subject: Re: [jQuery] regular expressions
Quick tut:
Just typing something out, eg, /abcd/ would replace anything that contained the
exact string abcd, case sensative. If you do /[abcd]/, notice the brackets,
it will select the letter a, the letter b, etc. For ranges you can do
bump?
himynameiznate wrote:
This may have been answered somewhere, but alas, I cannot find it.
I would like to use a regular expression to filter through certain dom
elements, but Im not sure if jQuery takes regex.
Also, it might be possible with attribute selectors, but Im not sure how.
himynameiznate schrieb:
This may have been answered somewhere, but alas, I cannot find it.
I would like to use a regular expression to filter through certain dom
elements, but Im not sure if jQuery takes regex.
Also, it might be possible with attribute selectors, but Im not sure how.
I want
This may have been answered somewhere, but alas, I cannot find it.
I would like to use a regular expression to filter through certain dom
elements, but Im not sure if jQuery takes regex.
Also, it might be possible with attribute selectors, but Im not sure how.
I want to grab all divs with an ID