473,659 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regexp replace question

Hello,

I'm new to VB.NET but have used regexp in Perl and VI.

I'd like to read a regular expression from a file and apply it to a
string read from another file. The regexp is simple word replace
operation, so my input regexp file lines might look like this:

/foo/bar/

So if a line in input file looked like "I'd like to foo", then the
output line would be "I'd like to bar".

It seems so simple, but I can't find the right form.

--
Cheers,

bill
Nov 21 '05 #1
2 1474
Dont know abt the regex part.
But if you have reached the point when you know you need to convert this
string to that,

Then you can use String.Replace method

I hope the initial part wasnt the real problem :-)

HTH
rawCoder
"Bill McCormick" <so*******@yaho o.com> wrote in message
news:Fw******** ********@newssv r14.news.prodig y.com...
Hello,

I'm new to VB.NET but have used regexp in Perl and VI.

I'd like to read a regular expression from a file and apply it to a
string read from another file. The regexp is simple word replace
operation, so my input regexp file lines might look like this:

/foo/bar/

So if a line in input file looked like "I'd like to foo", then the
output line would be "I'd like to bar".

It seems so simple, but I can't find the right form.

--
Cheers,

bill

Nov 21 '05 #2
rawCoder said the following on 9/8/2005 12:50 PM:
Dont know abt the regex part.
But if you have reached the point when you know you need to convert this
string to that,

Then you can use String.Replace method

Understood. But I'd like to know how to do it with regexp.


I hope the initial part wasnt the real problem :-)

HTH
rawCoder
"Bill McCormick" <so*******@yaho o.com> wrote in message
news:Fw******** ********@newssv r14.news.prodig y.com...
Hello,

I'm new to VB.NET but have used regexp in Perl and VI.

I'd like to read a regular expression from a file and apply it to a
string read from another file. The regexp is simple word replace
operation, so my input regexp file lines might look like this:

/foo/bar/

So if a line in input file looked like "I'd like to foo", then the
output line would be "I'd like to bar".

It seems so simple, but I can't find the right form.

--
Cheers,

bill



--
Cheers,

bill
Nov 21 '05 #3

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

Similar topics

4
24749
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. Also, are they any great references for learning how to use Regular Expressions?
5
1820
by: Dr John Stockton | last post by:
ISTM that RegExps deserve a FAQ entry, with links to more detailed sources. An important question, probably not treated by many otherwise worthwhile sources, must be on feature detection of the newer RegExp facilities - for example, greedy/non-greedy. The answer may be that it is not possible to do so in a safe manner; that one can do no better than something like
4
1682
by: Ian Renfrew | last post by:
To replace characters, I currently run the following code: oStr = oStr.replace(/\xFC/g,"\t"); // replace sub-value mark(s) with tab(s) Ideally, I'd like to replace the hard coded string \xFC with a variable such as delim. I tried: oStr = oStr.replace(/delim/g,"\t"); // replace sub-value mark(s) with tab(s)
4
7465
by: Jon Maz | last post by:
Hi All, I want to strip the accents off characters in a string so that, for example, the (Spanish) word "práctico" comes out as "practico" - but ignoring case, so that "PRÁCTICO" comes out as "PRACTICO". What's the best way to do this? TIA,
13
1828
by: Phat G5 (G3) | last post by:
I am weak when it comes to regexp but hoped someone might know in this case. I am trying to take a url like this : something.lasso?blah=blah&blah2=blah2&sort=hello&blah3=blah3 And remove the &sort=XXX without hurting the rest of the url. The parameter to be replaced would be a parameter passed to a function. Here is what I have so far: function refresh(item) {
6
4500
by: jiing24 | last post by:
I try to use regexp to replace some html tags in DOM, but the result seems some problems, ================================ <Script language="javascript" type="text/javascript"> var config = document.getElementById("rootconfig"); alert(config.innerHTML);
6
2202
by: Matt | last post by:
Premise: Inserting data into a database form a <textarea> and displaying this data through an HTML page. When inserting data into a database via a text area and then displaying this data any carriage return that was entered into the database was lost. I Created a function to replace a carriage return with a <BR>. I call this function when I display this data. If I enter text inside <> into a database and then display this data, any...
7
3439
by: Csaba Gabor | last post by:
I need to come up with a function function regExpPos (text, re, parenNum) { ... } that will return the position within text of RegExp.$parenNum if there is a match, and -1 otherwise. For example: var re = /some(thing|or other)?.*(n(est)(?:ed)?.*(parens) )/ var text = "There were some nesting parens in the test"; alert (regExpPos (text, re, 3));
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.