Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Regex Expression in VBA

Posted on 2015-01-11
6
106 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 84

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:Michael74
Michael74 earned 250 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 23

Expert Comment

by:Michael74
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 84

Accepted Solution

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

Author Closing Comment

by:AXISHK
ID: 40543633
Tks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

856 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