06-05-2012, 12:36 PM
Hi supputuri,
Thanks for your help.It gave me another way to look at these matching/extraction issues.
Then i Tried this:
strlocation="D:\Documents and Settings\Desktop\New Folder"
Objective: To extract the folder name and the file path from the above location.
For the folder name i tried the following code:
'***********************************
'**********************************
Here the problem that i came across is that if i use the pattern as "[A-Z a-z]*$" then it gives two values in the match collection returned by Execute which are :"New Folder" and "".
So then i changed the pattern to "[A-Z a-z ]*$" and it gave me the correct result but the question is by looking at the input it seems that no additional space is there then why is it required in the regular expression?Please clarify.
Thanks for your help.It gave me another way to look at these matching/extraction issues.
Then i Tried this:
strlocation="D:\Documents and Settings\Desktop\New Folder"
Objective: To extract the folder name and the file path from the above location.
For the folder name i tried the following code:
'***********************************
Code:
Set obj=New Regexp
obj.pattern="[A-Z a-z]*$"
obj.global=True
Set num2=obj.execute(d)
msgbox num2.count
For i=0 to num2.count-1
msgbox num2(i)
Next
Here the problem that i came across is that if i use the pattern as "[A-Z a-z]*$" then it gives two values in the match collection returned by Execute which are :"New Folder" and "".
So then i changed the pattern to "[A-Z a-z ]*$" and it gave me the correct result but the question is by looking at the input it seems that no additional space is there then why is it required in the regular expression?Please clarify.