LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default RegExp & VB Noob Qs

On Fri, 27 Jun 2008 06:30:33 -0400, Mike
wrote:

Hi all. I've found a litle set of scripts to use regex in Excel, but
there's a snafu. Here's the meat:

Set allMatches = REObject.Execute(StringToSearch)
ReDim result( 0 to allMatches.Count - 1)
For i = 0 to allMatches.Count - 1
result( i ) = allmatches( i ) .Value
next i

and so on,,,

Typically I want to find a substring consisting of the first match plus
a small range of the following chararcters(any characters), the second
match and a range after that, etc. Something like this:

vbscript( "the battlestar pegasus was run by a nutcase, and the
battestar galactic was a rustbucket", "battlestar.{0,30}")

What I want to get is "battletstar pegasus was run by" and battlestar
galatica was a rustbucket", or similar. The problem I run into is when
the tokens are close together. Then I somehow lose the second match:

vbscript( "the battlestar p and the battestar g are filled with
cylons", "battlestar.{0,16}")

In this case I get "battlestar p and", and then nothing for the second
match. It's as if the second match causes the first match to truncate
somehow. Does the object make a fixed range for each match or something?

Thx.


I suspect the "meat" is in your regex scrips and/or your data, and not in what
you posted.

It may be in how you define your "small range of the following characters".

It might also have to do with typos in your data -- there are several typos in
what you've posted and, if these were copied from your data, the regex's
probably would not behave as you expect.
--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
RegExp Arshavir Grigorian Excel Programming 2 March 13th 08 12:55 AM
RegExp information Alain R. Excel Programming 1 February 18th 08 02:56 PM
RegExp - String in VBA MSK Excel Programming 0 July 24th 07 02:50 PM
Declare RegExp from Vbscript.dll Bob Phillips Excel Programming 0 January 16th 07 07:45 PM
How do you look for two distinct patterns (RegExp) ExcelMonkey Excel Programming 1 August 7th 05 11:29 PM


All times are GMT +1. The time now is 02:37 PM.

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"