473,416 Members | 1,713 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.

Regular expression problem - Replacing a pattern

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, I want to use the
text included within the brackets to do a lookup so that I can replace
the expression with the new text.

For example:

Lets say the text file reads:
Hello {firstName}, Your account {accountName} has been updated.

I need to figure out how to write the expression so that the string
reads like:
Hello Dimitris, Your account Hotmail has been updated.

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.

Any help would be appreciated.

Dimitris
Nov 16 '05 #1
11 5341
for simple replacement like this you can use "String.Relace()" function
without having to use Regex.

String template = "Hello {firstName}, Your account {accountName} has been
updated.";
String name = "Dimitris";
String account = "Hotmail";
String message = "";

message = template.Replace("{firstName}", name);
message = message.Replace("{accountName}", account);

Console.WriteLine("String Replate: " + message);

// Alternative: regex
// since { and } are control chars u have to escape using \
message = Regex.Replace(template, @"\{firstName\}", name);
message = Regex.Replace(message, @"\{accountName\}", account);

Console.WriteLine("Regex Replate: " + message);

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.
i'm not sure what mean here, can you explain it a little more

anyway hope that helps,

Du

"Dimitris Georgakopuolos" <di*******@hotmail.com> wrote in message
news:ea**************************@posting.google.c om... 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, I want to use the
text included within the brackets to do a lookup so that I can replace
the expression with the new text.

For example:

Lets say the text file reads:
Hello {firstName}, Your account {accountName} has been updated.

I need to figure out how to write the expression so that the string
reads like:
Hello Dimitris, Your account Hotmail has been updated.

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.

Any help would be appreciated.

Dimitris

Nov 16 '05 #2
If you need to do a look-up somewhere, you can always use a MatchEvaluator.
Whatever is matched in this case will be sent to a function where you can return
the replacement result. If the match is firstName, then you can replace that
with
some user's first name. If the match is accountName, do your look-ups and
make the replacement for that.

It sounds like you want a generic tag replacement method and the MatchEvaluator
is exactly what you'd want in that case. Check out www.regexlib.com. A friend
of mine runs the site and they have loads of regular expressions stuff going on.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Du Dang" <vi*******@hotmail.com> wrote in message
news:Ix********************@nnrp1.uunet.ca...
for simple replacement like this you can use "String.Relace()" function
without having to use Regex.

String template = "Hello {firstName}, Your account {accountName} has been
updated.";
String name = "Dimitris";
String account = "Hotmail";
String message = "";

message = template.Replace("{firstName}", name);
message = message.Replace("{accountName}", account);

Console.WriteLine("String Replate: " + message);

// Alternative: regex
// since { and } are control chars u have to escape using \
message = Regex.Replace(template, @"\{firstName\}", name);
message = Regex.Replace(message, @"\{accountName\}", account);

Console.WriteLine("Regex Replate: " + message);

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.


i'm not sure what mean here, can you explain it a little more

anyway hope that helps,

Du

"Dimitris Georgakopuolos" <di*******@hotmail.com> wrote in message
news:ea**************************@posting.google.c om...
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, I want to use the
text included within the brackets to do a lookup so that I can replace
the expression with the new text.

For example:

Lets say the text file reads:
Hello {firstName}, Your account {accountName} has been updated.

I need to figure out how to write the expression so that the string
reads like:
Hello Dimitris, Your account Hotmail has been updated.

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.

Any help would be appreciated.

Dimitris


Nov 16 '05 #3
Du,

I appreciate your help. I apologize for not being clear the first
time around. What I am trying to do is retrieve the values to do the
replacement dynamically, therefore I do not know ahead of time in
design time of the type of fields to look for; it could be
{firstName} or {lastName} or 100 other fields that I don't want to
hard code.

I was looking at an example like this for dates and want to do
something similar for my scenario but I am not sure of the best way to
accomplish it:

return Regex.Replace(input,
"\\b(?<month>\\d{1,2})/(?<day>\\d{1,2})/(?<year>\\d{2,4})\\b",
"${day}-${month}-${year}");

Would something like this work:

return Regex.Replace(input,
"{(?<name>}",
GetReplacement("${name});

Thanks for all your help,

Dimitris

"Du Dang" <vi*******@hotmail.com> wrote in message news:<Ix********************@nnrp1.uunet.ca>...
for simple replacement like this you can use "String.Relace()" function
without having to use Regex.

String template = "Hello {firstName}, Your account {accountName} has been
updated.";
String name = "Dimitris";
String account = "Hotmail";
String message = "";

message = template.Replace("{firstName}", name);
message = message.Replace("{accountName}", account);

Console.WriteLine("String Replate: " + message);

// Alternative: regex
// since { and } are control chars u have to escape using \
message = Regex.Replace(template, @"\{firstName\}", name);
message = Regex.Replace(message, @"\{accountName\}", account);

Console.WriteLine("Regex Replate: " + message);

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.


i'm not sure what mean here, can you explain it a little more

anyway hope that helps,

Du

"Dimitris Georgakopuolos" <di*******@hotmail.com> wrote in message
news:ea**************************@posting.google.c om...
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, I want to use the
text included within the brackets to do a lookup so that I can replace
the expression with the new text.

For example:

Lets say the text file reads:
Hello {firstName}, Your account {accountName} has been updated.

I need to figure out how to write the expression so that the string
reads like:
Hello Dimitris, Your account Hotmail has been updated.

after the replacement. Keep in mind that I need to use the value
contained in the brackets so that I can do a lookup to figure what the
corresponding replacement is.

Any help would be appreciated.

Dimitris

Nov 16 '05 #4
Hi !

Dimitris Georgakopuolos wrote:
[...snip...]
What I am trying to do is retrieve the values to do the
replacement dynamically, therefore I do not know ahead of time in
design time of the type of fields to look for; it could be
{firstName} or {lastName} or 100 other fields that I don't want to
hard code. [...snip...] Would something like this work:

return Regex.Replace(input,
"{(?<name>}",
GetReplacement("${name});

[...snip...]

Let's assume your string is "Hello {firstName}, Your account {accountName}
has been
updated."

As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to start
with would be "\{.\}" which would detect wether there is any occurrence of a
pair of curly brackets in your string. Remember to put an @ in front of your
regular expression string, so C# knows the \ belong into your string and are
not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression above
would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the . "lazy"
by adding a "?" behind. That makes "\{.?\}" for our improved expression.
This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular expression, so
we crate a named group: "\{(?'groupname'.?)\}". This will find any sequence
of characters (.?) between a pair of curly brackets (\{ and \}) and store it
in the group named "groupname" for each match. ?'groupname' names the group
(you can use ?<groupname> instead) and everything else between the () makes
the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ==========================
=====

string myString = "Hello {firstName}, Your account {accountName} has been
updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.?)\}",
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically
// on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ==========================
=====
Nov 16 '05 #5
FYI, the code I posted previously has not been tested...
Nov 16 '05 #6
And add an additional ":
myString = Regex.Replace(myString, @"\{" + lookForMe + @"\}",

^
missing "-------------------------------------------------|
Nov 16 '05 #7

"Michael Voss" <mi**********@lvrREMOVE.deCAPS> schrieb im Newsbeitrag
news:4083d5cb$1@news...
Hi !

Dimitris Georgakopuolos wrote:
[...snip...]
What I am trying to do is retrieve the values to do the
replacement dynamically, therefore I do not know ahead of time in
design time of the type of fields to look for; it could be
{firstName} or {lastName} or 100 other fields that I don't want to
hard code. [...snip...]
Would something like this work:

return Regex.Replace(input,
"{(?<name>}",
GetReplacement("${name});

[...snip...]

Let's assume your string is "Hello {firstName}, Your account

{accountName} has been
updated."

As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to start with would be "\{.\}" which would detect wether there is any occurrence of a pair of curly brackets in your string. Remember to put an @ in front of your regular expression string, so C# knows the \ belong into your string and are not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression above would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the . "lazy" by adding a "?" behind. That makes "\{.?\}" for our improved expression.
This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular expression, so we crate a named group: "\{(?'groupname'.?)\}". This will find any sequence of characters (.?) between a pair of curly brackets (\{ and \}) and store it in the group named "groupname" for each match. ?'groupname' names the group (you can use ?<groupname> instead) and everything else between the () makes the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ========================== =====

string myString = "Hello {firstName}, Your account {accountName} has been
updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.?)\}",
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically
// on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ========================== =====

Nov 16 '05 #8
Oops - I should rather test the code I give away before posting...
I missed a very important "*" for the Regex to match not just one character
between {}...
As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to start with would be "\{.*\}" which would detect wether there is any occurrence of a
^
--------------------| need a "*" here to match more than one character !!!!
pair of curly brackets in your string. Remember to put an @ in front of your regular expression string, so C# knows the \ belong into your string and are not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression above would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the .* "lazy"
^
----------------------------------------------------------------------|
need another "*" here to match more than one character !!!!
by adding a "?" behind. That makes "\{.*?\}" for our improved expression. ^
-----------------------------------------|
and another "*" goes here !!!!!!
This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular expression, so we crate a named group: "\{(?'groupname'.*?)\}". This will find any sequence
^
-------------------------------------------|
ok, another "*" here ... of characters (.*?) between a pair of curly brackets (\{ and \}) and store it
^
------------------|
and "*" here again !!!!
in the group named "groupname" for each match. ?'groupname' names the group (you can use ?<groupname> instead) and everything else between the () makes the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ==========================
string myString = "Hello {firstName}, Your account {accountName} has been
updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.*?)\}", ^
-------------------------------------------------|
and again another "*" here !!!!!! That's it !
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically
// on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ==========================

Sorry, but I had no time to test it before I posted originally...
Nov 16 '05 #9
lena test
"Michael Voss" <mi**********@lvrREMOVE.deCAPS> wrote in message
news:40876e39$1@news...

"Michael Voss" <mi**********@lvrREMOVE.deCAPS> schrieb im Newsbeitrag
news:4083d5cb$1@news...
Hi !

Dimitris Georgakopuolos wrote:
[...snip...]
What I am trying to do is retrieve the values to do the
replacement dynamically, therefore I do not know ahead of time in
design time of the type of fields to look for; it could be
{firstName} or {lastName} or 100 other fields that I don't want to
hard code. [...snip...]
Would something like this work:

return Regex.Replace(input,
"{(?<name>}",
GetReplacement("${name});

[...snip...]

Let's assume your string is "Hello {firstName}, Your account

{accountName}
has been
updated."

As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to

start
with would be "\{.\}" which would detect wether there is any occurrence of a
pair of curly brackets in your string. Remember to put an @ in front of your
regular expression string, so C# knows the \ belong into your string and

are
not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression

above
would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the .

"lazy"
by adding a "?" behind. That makes "\{.?\}" for our improved expression.
This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular

expression, so
we crate a named group: "\{(?'groupname'.?)\}". This will find any sequence
of characters (.?) between a pair of curly brackets (\{ and \}) and

store it
in the group named "groupname" for each match. ?'groupname' names the

group
(you can use ?<groupname> instead) and everything else between the ()

makes
the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ========================== =====

string myString = "Hello {firstName}, Your account {accountName} has been updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.?)\}",
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically
// on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ==========================
=====


Nov 16 '05 #10
aaaaaaaaaaaaaaaaaa
"Michael Voss" <mi**********@lvrREMOVE.deCAPS> wrote in message
news:40876fea$1@news...
Oops - I should rather test the code I give away before posting...
I missed a very important "*" for the Regex to match not just one character between {}...
As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to start
with would be "\{.*\}" which would detect wether there is any occurrence

of a
^
--------------------| need a "*" here to match more than one character

!!!!
pair of curly brackets in your string. Remember to put an @ in front of your
regular expression string, so C# knows the \ belong into your string and

are
not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression

above
would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the .*

"lazy"
^
----------------------------------------------------------------------|
need another "*" here to match more than one character !!!!
by adding a "?" behind. That makes "\{.*?\}" for our improved expression. ^
-----------------------------------------|
and another "*" goes here !!!!!!
This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular
expression, so
we crate a named group: "\{(?'groupname'.*?)\}". This will find any sequence
^
-------------------------------------------|
ok, another "*" here ...
of characters (.*?) between a pair of curly brackets (\{ and \}) and

store it
^
------------------|
and "*" here again !!!!
in the group named "groupname" for each match. ?'groupname' names the group
(you can use ?<groupname> instead) and everything else between the ()

makes
the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ==========================
string myString = "Hello {firstName}, Your account {accountName} has been updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.*?)\}",

^
-------------------------------------------------|
and again another "*" here !!!!!! That's it !
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically
// on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ==========================
Sorry, but I had no time to test it before I posted originally...

Nov 16 '05 #11
privet
"Boris" <bo*****@optonline.net> wrote in message
news:y5***********************@news4.srv.hcvlny.cv .net...
lena test
"Michael Voss" <mi**********@lvrREMOVE.deCAPS> wrote in message
news:40876e39$1@news...

"Michael Voss" <mi**********@lvrREMOVE.deCAPS> schrieb im Newsbeitrag
news:4083d5cb$1@news...
Hi !

Dimitris Georgakopuolos wrote:
[...snip...]
> What I am trying to do is retrieve the values to do the
> replacement dynamically, therefore I do not know ahead of time in
> design time of the type of fields to look for; it could be
> {firstName} or {lastName} or 100 other fields that I don't want to
> hard code.
[...snip...]
> Would something like this work:
>
> return Regex.Replace(input,
> "{(?<name>}",
> GetReplacement("${name});
[...snip...]

Let's assume your string is "Hello {firstName}, Your account {accountName}
has been
updated."

As Du pointed out, the { and } will have to be escaped. Then, you are
looking for everything between \{ and \}, so the regular expression to

start
with would be "\{.\}" which would detect wether there is any occurrence of
a
pair of curly brackets in your string. Remember to put an @ in front
of
your
regular expression string, so C# knows the \ belong into your string
and are
not C#-escape-characters.
You will most likely want to find the shortest pair, as the expression

above
would find one occurence in our string, containing "firstName}, Your
account {accountName" between the pair of brackets. So we make the .

"lazy"
by adding a "?" behind. That makes "\{.?\}" for our improved

expression. This expression will match twice, with "firstname" and "accountname"
included between the two pairs of brackets.
Next, you want to remember the value that matches the regular

expression,
so
we crate a named group: "\{(?'groupname'.?)\}". This will find any

sequence
of characters (.?) between a pair of curly brackets (\{ and \}) and

store
it
in the group named "groupname" for each match. ?'groupname' names the

group
(you can use ?<groupname> instead) and everything else between the ()

makes
the expression, that will be stored in the group "groupname".
Finally, we want to iterate over the matches:

================================================== ==========================
=====

string myString = "Hello {firstName}, Your account {accountName} has been updated.";

// Create a new regular expression
// Adding the Singleline-Option makes the . include \n-Characters.
// If there is no \n between {}, make it RegexOptions.None or
// do not add any option
Regex expression = new Regex(@"\{(?'groupname'.?)\}",
RegexOptions.Singleline);

// Find all matches for our regular expression in myString
MatchCollection matchCol = expression.Matches(myString);

// Iterate over the matches
foreach (Match foundOne in matchCol)
{
// Get the contents between the {} for the current match
// Will be "firstName" for the first match and "accountName"
// for the second match
string lookForMe = foundOne.Groups["groupname"].Value;

// Find the Value to replace lookForMe with
string replacement = this.findSomeDataForKeyString(lookForMe);

// Finally, replace lookForMe by replacement in the source string
// We do this by a new regular expression which is built dynamically // on the key we are processing...
myString = Regex.Replace(myString, @"\{" + lookForMe + @\}",
replacement);
};

================================================== ==========================
=====



Nov 16 '05 #12

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

Similar topics

14
by: Tina Li | last post by:
Hello, I've been struggling with a regular expression for parsing XML files, which keeps giving the run time error "maximum recursion limit exceeded". Here is the pattern string: ...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
1
by: William Morris | last post by:
Been pounding on this for an hour and eating up my day's productivity, so I thought I'd throw a question out there. (I'm also reading through the Google archives to try to find this answer...) ...
5
by: Mahesha | last post by:
Hello, I need help in replacing one string pattern with another. Ex: I have a financial security expression like log(T 3.25 6/24/2004)/sqrt(T 4.5 6/19/2002) Here "T 3.25 6/24/2004" is a...
3
by: James D. Marshall | last post by:
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...
8
by: P K | last post by:
I have an XML in which I have to comment out the <responseopt> tag the tags between this tag should not be commented I plan to use regular expressions The tags looks like this <responseopt...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
17
by: Randy Webb | last post by:
I know that the /g flag will match all occurrences. Is there a way, with a Regular Expression, to match all occurrences *except* the last one? pattern = /df/g; var myString = "asdfasdfasdfasdf";...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
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
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
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...
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
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...
0
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...

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.