[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Regex Expression in VBA

Posted on 2015-01-11
6
Medium Priority
?
112 Views
Last Modified: 2015-01-11
"(http://)?([\w-]+\.)([\w-]+\.)?([\w-]+)([:/].*)?"

To verify my understanding, the submatch is
1. (http://)?
2. ([\w-]+\.)
3. ([\w-]+\.)?
4. ([\w-]+)
5. ([:/].*)?

The division of "?" is following the matching expression in each portion, correct ?

For the 5th submatch : ([:/].*)?, "?" mean zero or more for the expression within (). but what does ".*" mean ? Tks


Tks
0
Comment
Question by:AXISHK
  • 2
  • 2
  • 2
6 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 40543621
The ? in (http://)? makes the match of http:// optional
The ? in ([\w-]+\.)? makes the match of [\w-]+\. optional
The ? in ([:/].*)? makes the match of [:/].* optional
0
 
LVL 23

Assisted Solution

by:Michael Fowler
Michael Fowler earned 1000 total points
ID: 40543622
The question mark tells the regex to match 0 or 1 of the preceding pattern

so

(http://)?  allows for the pattern "http://" to be present or missing
0
 

Author Comment

by:AXISHK
ID: 40543623
Tks

([:/].*)?  -

For ".*" ,  what does it actually mean ?
.            Matches any single character except a new line character
*            Matches preceding element zero or more times
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Michael Fowler
ID: 40543626
This matches any string which does not contain a new line. As it is zero or more times it will also match empty strings
0
 
LVL 85

Accepted Solution

by:
ozo earned 1000 total points
ID: 40543627
.* matches any number of non-new line characters
0
 

Author Closing Comment

by:AXISHK
ID: 40543633
Tks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question