View Full Version : Regxp

08-30-2011, 09:10 AM
Hey guys, I have the following regxp .match()

debugtest = debugtest.match(/(/**/ jordan30001[CD])/)[1];

what i want to do with this regxp is with the /**/ and what i want to do is make it match a 1 didgit number or a 2 didgit number for example

10 jordan30001[CD]
1 jordan30001[CD]

how would i acomplish this i know that i could change /**/ to \d\d but that would only find 2 numbers and not 1 if theres only 1

08-30-2011, 09:59 AM
debugtest = debugtest.match(/(\d{1,2})\sjordan30001\[CD\]/)[1];

08-30-2011, 10:36 AM
thank you very much.

08-30-2011, 11:54 AM
just so i dont make a new topic would this work or would i have to remove the quotations?

matchDataStruct = "/(\d{1,2}\s" + namedPlayer + "\[" + playerGuild + "\]\s(\d)+,(\d)+,*(\d)+)/";
emptyhtml = emptyhtml.match(matchDataStruct)[1];

08-30-2011, 01:31 PM
No this wouldn't work but it also won't help to remove the quotation marks.

To assemble a regular expression as a concatenated string, you'll need to use the RegExp constructor like this

matchDataStruct = new RegExp("/(\d{1,2}\s" + namedPlayer + "\[" + playerGuild + "\]\s(\d)+,(\d)+,*(\d)+)/");

08-30-2011, 01:43 PM
thanks again