Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Replace a RegExp pattern with another RegExp patte

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,977
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Replace a RegExp pattern with another RegExp patte
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Replace a RegExp pattern with another RegExp patte - 2/26/2004 3:23:28 AM   
  Alain L

 

Posts: 1
Score: 0
Joined: 2/26/2004
From: Canada
Status: offline
Hi,

It's my first stab at Regular Expressions and I haven't found an example yet showing how to replace pattern1 with pattern2, as in:


pattern 1:
\w{2};\d{2}-\d{2}-\d{4};\w{6,};\d{1,2};[0-9\-]+;[0-9\-]+;[0-9\.\-]+;[0-9\.\-]+

pattern 2:
\(''\w{2}'',''\d{2}-\d{2}-\d{4}'',''\w{6,}'',\d{1,2},\d+,\d+,[0-9\.\-]+,[0-9\.\-]+\)

string to replace:
EU;30-07-2005;100000;97;31;904;-3.00;45.00
EU;30-07-2005;101405;28;1;2;0.1;0.1
EU;30-07-2005;101405;36;4;12;123;456



I can match pattern1, no problem, but I can't replace it with pattern2...


The final string I'm trying to get is the following:
''EU'',''30-07-2005'',''100000'',97,31,904,-3.00,45.00
''EU'',''30-07-2005'',''101405'',28,1,2,0.1,0.1
''EU'',''30-07-2005'',''101405'',36,4,12,-123,456

(in other words, replace first three semicolon delimited fields by putting two apostrophes ('') at the begin and end of each field and replace all semicolons with commas)



Can anybody help me with that? Any help would be very helpful... Thanks,


Alain
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Replace a RegExp pattern with another RegExp patte Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts