473,416 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Replacing special chars using regular expressions

The issue at hand, I believe is my comprehension of using regular
expression, specially to assist in replacing the expression with other text.
using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.

This search
ElseIf InStr(1, indivline, "$") Then
insert a replace statement that uses the regular expression to find and
replace all the white space between the character sets

returns
C$ NTFS 34168 18461 15707 'there could be one or more
occurrences. No problem finding them
leading spaces before the C$
spaces between C$ and NTFS
tab and spaces after NTFS and first set of numbers
spaces between remaining sets of numbers (not always consistent on the
number of spaces) and ending with a carriage return

using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.
I have imported system.text.regularexpression
issue is I am just not getting it trying to use the regular expression, but
I believe it is the better solution.
Nov 21 '05 #1
3 3195
James,

I don't know who are active this weekend

The regular expression is not my stuff, however here a nice link for that.
http://www.regexlib.com/REDetails.aspx?regexp_id=464

Merry Christmas

Cor

"James D. Marshall" <cr**********@hotmail.com>
The issue at hand, I believe is my comprehension of using regular
expression, specially to assist in replacing the expression with other
text.
using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.

This search
ElseIf InStr(1, indivline, "$") Then
insert a replace statement that uses the regular expression to find and
replace all the white space between the character sets

returns
C$ NTFS 34168 18461 15707 'there could be one or
more occurrences. No problem finding them
leading spaces before the C$
spaces between C$ and NTFS
tab and spaces after NTFS and first set of numbers
spaces between remaining sets of numbers (not always consistent on the
number of spaces) and ending with a carriage return

using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.
I have imported system.text.regularexpression
issue is I am just not getting it trying to use the regular expression,
but I believe it is the better solution.

Nov 21 '05 #2
Thank You
Yes this did help, although I didn't use the exact same string as below.
Followed the links to a neat tool called "The Regulator" and was able to
build the regular expression pattern. Now to get the replace to work with
regular expressions.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
James,

I don't know who are active this weekend

The regular expression is not my stuff, however here a nice link for that.
http://www.regexlib.com/REDetails.aspx?regexp_id=464

Merry Christmas

Cor

"James D. Marshall" <cr**********@hotmail.com>
The issue at hand, I believe is my comprehension of using regular
expression, specially to assist in replacing the expression with other
text.
using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.

This search
ElseIf InStr(1, indivline, "$") Then
insert a replace statement that uses the regular expression to find
and replace all the white space between the character sets

returns
C$ NTFS 34168 18461 15707 'there could be one or
more occurrences. No problem finding them
leading spaces before the C$
spaces between C$ and NTFS
tab and spaces after NTFS and first set of numbers
spaces between remaining sets of numbers (not always consistent on the
number of spaces) and ending with a carriage return

using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.
I have imported system.text.regularexpression
issue is I am just not getting it trying to use the regular expression,
but I believe it is the better solution.


Nov 21 '05 #3
Thanks for all the assistance, have the console app and running, it
completed its task in just over 6 minutes, compare that over 2 hours for
what one person wrote using java (another example why java is really a
virus) oooops, am I gonna pay for that remark.
"James D. Marshall" <cr**********@hotmail.com> wrote in message
news:am0zd.807452$8_6.531355@attbi_s04...
The issue at hand, I believe is my comprehension of using regular
expression, specially to assist in replacing the expression with other
text.
using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.

This search
ElseIf InStr(1, indivline, "$") Then
insert a replace statement that uses the regular expression to find and
replace all the white space between the character sets

returns
C$ NTFS 34168 18461 15707 'there could be one or
more occurrences. No problem finding them
leading spaces before the C$
spaces between C$ and NTFS
tab and spaces after NTFS and first set of numbers
spaces between remaining sets of numbers (not always consistent on the
number of spaces) and ending with a carriage return

using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.
I have imported system.text.regularexpression
issue is I am just not getting it trying to use the regular expression,
but I believe it is the better solution.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Martin | last post by:
I have a HTML parser that reads product pages from various retailers - and I want to optimize it somewhat: I download all HTML before I start the parsing - and to do that I want to: - Get rid...
14
by: tertius | last post by:
Is there a better way to append certain chars in a string with a backslash that the example below? chr = "#$%^&_{}" # special chars to look out for str = "123 45^ & 00 0_" # string to...
7
by: Mindy Geac | last post by:
Is it possible to delete special caracters from a string and multiple spaces? When the input is : "a&*bbb cc/c d!d" I want the result : "abbb ccc dd" thnx. MJ <?php
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
7
by: arno | last post by:
Hi, I want to search a substring within a string : fonction (str, substr) { if (str.search(substr) != -1) { // do something } }
5
by: M Kinnear | last post by:
I want to check a string only contains a-z 0-9 ( ) . and # I've used ereg("^*)$"),$instr) which parses a string correctly until I try and parse a !,",£,$ ... or any of the other...
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
11
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?",...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.