Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
| Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 8th, 2004, 01:06 PM
Registered User
 
Join Date: Sep 2004
Location: Burlington, , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Dereksam
Default Question on Pattern matching using VBscript

Hi:

I am new to Vbscript. I need to macth a pattern in a string. Ex I need to match startup_qkload_test_8to1_pm_st out of the line below:
call startup_qkload_test_8to1_pm_st > TS0 .X .X .X .0 1X11 .1 1100XX .1 10XX10 ;
I use subRE.pattern="call ([a-zA-Z][\w]+[a-zA-Z]) >" hoping that the matches object will remember only the portion in the parenthesis ([a-zA-Z][\w]+[a-zA-Z]) but it seems to match call startup_qkload_test_8to1_pm_st > when all I want is startup_qkload_test_8to1_pm_st

Thnx
Derek

Reply With Quote
  #2 (permalink)  
Old September 9th, 2004, 04:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

You shouldn't be surprised that your regexp matches the part you've asked it to match! The part in parentheses will be in yourmatch.SubMatches(0)

you can test whether there's anything there by first checking that
yourmatch.SubMatches.Count = 1.

hth
Phil
Reply With Quote




Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Matching pattern in Given String sanjivbshinde ASP.NET 2.0 Professional 3 October 10th, 2008 06:32 PM
Regular expression to select non-matching pattern Neuron BOOK: Beginning Regular Expressions 1 June 12th, 2006 10:06 AM
javascript pattern matching... rbd Javascript 1 October 7th, 2004 12:20 PM
PHP Pattern Matching joanncae BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 May 17th, 2004 04:52 PM
Pattern Matching using PHP spraveens PHP Databases 2 March 23rd, 2004 10:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.