Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 02-25-2007, 02:43 PM RegEx Help
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
I was wonder if someone could write me a little regular expression. I have some knowledge about these but for some reason i cant pick up everything about them yet.

I'm writing a vbscript that will search a computer for all folders/files and create an xlm file that would be a tree to your entire computer. Dont ask, its just for fun . The problem i get is when a folder starts with an illegal character (ex: -, =, ~, ` ) it gives me an XLM error. So i'm looking to return everything in the folder name unless the folder starts or ends with an illegal character. I'm not sure but i think if the character isnt in the begining or end then its ok for xml.

TY!
The_Anomaly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-25-2007, 02:47 PM RegEx Help
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
I was wonder if someone could write me a little regular expression. I have some knowledge about these but for some reason i cant pick up everything about them yet.

I'm writing a vbscript that will search a computer for all folders/files and create an xlm file that would be a tree to your entire computer. Dont ask, its just for fun . The problem i get is when a folder starts with an illegal character (ex: -, =, ~, ` ) it gives me an XLM error. So i'm looking to return everything in the folder name unless the folder starts or ends with an illegal character. I'm not sure but i think if the character isnt in the begining or end then its ok for xml.

TY!

Added: I was wrong. the illegal character cannot be found anywhere within the strong. I need to strip the entire string. I guess i would need something that would return all the letters and numbers with nothing else.

Right now i have ([A-Za-z0-9]+) which i think will do the trick. But i forgot how to return the results
The_Anomaly is offline
Reply With Quote
View Public Profile
 
Old 02-25-2007, 03:57 PM Re: RegEx Help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
modify the function I coded for one of your other threads http://www.webmaster-talk.com/asp-fo...alidation.html

change the pattern to be

Code:
objRE.pattern = "^(\~|\=|\-|\')"
This will match a -, =, ~ or ' only at the start of a string
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-25-2007, 04:12 PM Re: RegEx Help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
remove the ^ symbol from pattern in thread http://www.webmaster-talk.com/asp-fo...egex-help.html

It will then match anywhere in the string

(Threads should be merged at some point)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-26-2007, 04:07 AM Re: RegEx Help
DaveMo~'s Avatar
Administrator
Defies A Status

Posts: 10,200
Name: Dave
Location: Scott Depot, West Virginia, USA
Trades: 1
Merged!

Dave
__________________

Please login or register to view this content. Registration is FREE
:
Please login or register to view this content. Registration is FREE
:
Please login or register to view this content. Registration is FREE
:

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
?

DaveMo~ is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 04:38 PM Re: RegEx Help
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
I would think a better way than changing the name of the directory you report back ( and then won't be able to find because you have the wrong name ) would be to use quotes around the dir names, or to escape the illegal characters somehow.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to RegEx Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.21987 seconds with 12 queries