Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default RegEx Replacement patterns

Hey guys,

I'm working with a regular expression to replace patterns in a given
string. however I want to replace the patterns with another pattern
using submatch references.

ie:
if my search pattern was
"(\s)ks ?#?(\d*)(\s)"

and my replacement pattern was
"\1KS \2\3"

I would expect " ks#12 " or " kS12 " to convert to " KS 12 "

The regEx object has a replace method but it does the replacement as a
literal string copy of the replacement pattern instead of using the
submatches.
This is easy to do with most other regEx implimentations I can think
of.
any Ideas?

thanks in advance
Shaun

Reply
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
automated cut and paste using regex excel_newbie Excel Worksheet Functions 2 March 20th 09 12:29 PM
MS Query capabilities/regex Mike[_10_] New Users to Excel 2 June 23rd 08 09:19 PM
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
regex string matching Jamie Martin[_2_] Excel Programming 3 September 26th 03 09:28 PM


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