473,320 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Regular Expressions and a question of sanity

Could anyone explain what's going on here? I'm going nuts.

I pull some text from an XML file and store it in a Javascript object
(config.CopyRule.TargetFileNameRegExp). For some reason I can't use it in a
JS RegExp constructor. I've tried a million things but still can't work out
what is going on:

Using Microsoft (R) Windows Script Host Version 5.6

var abc = "MARS_25Oct05_20.38.txt";
//var def = new String((config.CopyRule.TargetFileNameRegExp).toSt ring());
// also fails
var def = new String(config.CopyRule.TargetFileNameRegExp);
logMessage(DEBUG, "def=:"+def+":");

var ghi = new String("^.+\\.txt$");
var xyz = new RegExp(def);
if (xyz.test(abc)) {
logMessage(DEBUG, "Match");
}
else {
logMessage(DEBUG, "No Match");
}
xyz.compile(def.toString());
if (xyz.test(abc)) {
logMessage(DEBUG, "Match");
}
else {
logMessage(DEBUG, "No Match");
}
xyz.compile(ghi);
if (xyz.test(abc)) {
logMessage(DEBUG, "Match");
}
else {
logMessage(DEBUG, "No Match");
}
xyz.compile("^.+\\.txt$");
if (xyz.test(abc)) {
logMessage(DEBUG, "Match");
}
else {
logMessage(DEBUG, "No Match");
}

Results in
def=:^.+\\.txt$:
No Match
No Match
Match
Match

Nov 23 '05 #1
7 975
Don't you love it when you post and then solve the problem in the next five
minutes?

So I made the XML file string "^.+\.txt$" instead of "^.+\\.txt$" ...

And all works ...

C
Nov 23 '05 #2
Chris McKay wrote on 16 nov 2005 in comp.lang.javascript:
Don't you love it when you post and then solve the problem in the next
five minutes?


Not when you are multiposting!!!!

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 23 '05 #3
I'm a little confused about this response?

Are you objecting to my post in microsoft.public.scripting.jscript?

C

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Chris McKay wrote on 16 nov 2005 in comp.lang.javascript:
Don't you love it when you post and then solve the problem in the next
five minutes?


Not when you are multiposting!!!!

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 23 '05 #4
Chris McKay wrote on 17 nov 2005 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> wrote in message
Chris McKay wrote on 16 nov 2005 in comp.lang.javascript:
Don't you love it when you post and then solve the problem in the next
five minutes?
Not when you are multiposting!!!!


[please do not toppost on usenet]
I'm a little confused about this response?
"?"?
Are you objecting to my post in microsoft.public.scripting.jscript?


Not at all, only to multiposting there and here.
Please crosspost instead if necessary.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 23 '05 #5
JRS: In article <Xn********************@194.109.133.242>, dated Thu, 17
Nov 2005 09:19:08, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
Chris McKay wrote on 17 nov 2005 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> wrote in message
Chris McKay wrote on 16 nov 2005 in comp.lang.javascript:
Don't you love it when you post and then solve the problem in the next
five minutes?

Not when you are multiposting!!!!


[please do not toppost on usenet]
I'm a little confused about this response?


"?"?
Are you objecting to my post in microsoft.public.scripting.jscript?


Not at all, only to multiposting there and here.
Please crosspost instead if necessary.


Those who correctly understand the meanings of cross-post and multi-post
will generally post correctly. So one should not assume that those who
post incorrectly will understand comments such as yours. Since the rest
of us prefer not to read repeated explanations here, the best thing is
to provide a suitable link, to FAQ 2.3 para 6, as below, or otherwise.

Being Dutch does not entitle you to believe that those with English, or
even Scottish, names are more fluent in English than you are!

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Nov 23 '05 #6
Dr John Stockton wrote on 18 nov 2005 in comp.lang.javascript:
Chris McKay wrote on 17 nov 2005 in comp.lang.javascript:

Being Dutch does not entitle you to believe that those with English, or
even Scottish, names are more fluent in English than you are!


Whether I am Dutch or not entitles me to believe whatever I believe,
since while believing something is or should be the result of thought,
that result cannot be changed by expediency.

btw, in Dutch gentry, there where [are?] people called:

Baron MacKaay
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 23 '05 #7
On 2005-11-17, Chris McKay <ki*****@gmail.com> wrote:
I'm a little confused about this response?

Not when you are multiposting!!!!


Post any message once, not multiple times.

Bye.
Jasen
Nov 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
1
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.