LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Another regular expression question

On Sat, 2 Feb 2013 00:29:55 -0700, "Robert Crandal" wrote:

"Ron Rosenfeld" wrote in message
.. .

That being the case, a regex such as:

^(\S+)(?:\s+(.+))?

should be all that you need.


Hi Ron. Just out of curiousity, what is the meaning of the colon
in the above pattern string?


You should have access to a comprehensive definition of the syntax for the relevant flavor if you are going to be using regular expressions.
Here is a link to the syntax used in the VBscript flavor: http://msdn.microsoft.com/en-us/libr...=vs.84%29.aspx

From that link:

==========================
(?:pattern)

Matches pattern but does not save the match, that is, the match is not stored for possible later use. This is useful for combining parts of a pattern with the "or" character (|).

industr(?:y|ies) is equivalent to industry|industries.
===========================

So using this makes the regex more efficient, as it does not have to store the part of the match that includes the spaces between the two elements that we want to match.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
R: Basic regular expression question r[_4_] Excel Programming 0 April 17th 11 11:08 PM
R: Basic regular expression question r[_4_] Excel Programming 0 April 17th 11 10:59 PM
Basic regular expression question Robert Crandal[_2_] Excel Programming 4 April 17th 11 12:10 PM
Can someone help me with this regular expression? [email protected] Excel Discussion (Misc queries) 3 March 10th 09 07:36 PM
Help with regular expression PO Excel Programming 3 May 2nd 07 01:39 PM


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"