LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Help with a Regex Pattern

On Sun, 29 Apr 2007 16:17:10 -0400, Ron Rosenfeld
wrote:

On Sun, 29 Apr 2007 15:04:07 -0400, "Dana DeLouis"
wrote:

What I'm thinking is that maybe something like
"A 123 k" might test True by ignoring the "A",
and
"ABC j 123 k" might test True by finding the pattern within a larger
string.


I guess one question which has not been answered is the reason for the regex.
Is it to extract any matching pattern from the string; or is it to ensure that
only the desired pattern is present.

If the latter, then your expression is appropriate.
--ron



Reading the OP's post again (and looking at his macro), it does seem as if he
wants to either match, or not match, the specific pattern. So your addition of
^ and $ would indeed be warranted.

And it's also possible to detect the format without regular expressions:

===============================
For Each c In rRng
If c.Text Like "[JjXxZz] ### [A-Za-z]" Or _
c.Text Like "### [A-Za-z]" Then
Debug.Print c.Text, "TRUE"
Else
Debug.Print c.Text, "FALSE"
End If
Next c
================================
--ron
 
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
Regex techniques Dave Runyan Excel Programming 5 April 28th 07 12:17 AM
RegEx to parse something like this... R Avery Excel Programming 2 March 7th 05 06:41 PM
RegEx Replacement patterns CodeSponge[_2_] Excel Programming 2 February 5th 05 07:39 AM
RegEx in VBE code editor R Avery Excel Programming 6 December 21st 04 01:58 PM
Regex Question William Barnes Excel Programming 5 January 2nd 04 11:57 AM


All times are GMT +1. The time now is 06:19 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"