regular expressions questions

  • Thread starter Thread starter z. f.
  • Start date Start date
Z

z. f.

Hi,

i know this forum is for dot-net framework, but regular expressions is part of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit this question or answer this question it will be very helpful.

TIA!!!
z.
 
1. Please post plain-text messages only
2. Why don't you simply replace "<title>" with "<title>XXX ", with a command
like String.Replace?

Niki

Hi,

i know this forum is for dot-net framework, but regular expressions is part
of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an
addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit
this question or answer this question it will be very helpful.

TIA!!!
z.
 
Match with

(<title>)(Hello)(</title)

Replace with

$1XXX$2$3

--Robby


Hi,

i know this forum is for dot-net framework, but regular expressions is part of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit this question or answer this question it will be very helpful.

TIA!!!
z.
 
1. the post is submitted both as text and html, is your reader supports html - u c html, if not u c text. it's 2004 not 1980, relax, anyway you can change your reader settings to show plain text only, if you prefer it this way.


2. your suggestion might work in this case but not in others,anyway i would like to do it with reg-ex.


1. Please post plain-text messages only
2. Why don't you simply replace "<title>" with "<title>XXX ", with a command
like String.Replace?

Niki

Hi,

i know this forum is for dot-net framework, but regular expressions is part
of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an
addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit
this question or answer this question it will be very helpful.

TIA!!!
z.
 
do you have a dot-net sample or link to sample that does that ?
and the Hello string is not always Hello, it might be anything.
it changes your sample.




Match with

(<title>)(Hello)(</title)

Replace with

$1XXX$2$3

--Robby


Hi,

i know this forum is for dot-net framework, but regular expressions is part of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit this question or answer this question it will be very helpful.

TIA!!!
z.
 
If it will not always be "Hello" then you need to replace the "(Hello)" with the regular expression that matches the general case. Take a look at the \w and \s character classes. You can use these to construct a simple general case that will meet your specific needs.

Robby
do you have a dot-net sample or link to sample that does that ?
and the Hello string is not always Hello, it might be anything.
it changes your sample.




Match with

(<title>)(Hello)(</title)

Replace with

$1XXX$2$3

--Robby


Hi,

i know this forum is for dot-net framework, but regular expressions is part of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit this question or answer this question it will be very helpful.

TIA!!!
z.
 
1. the post is submitted both as text and html, is your reader supports
html - u c html, if not u c text. it's 2004 not 1980, relax, anyway you can
change your reader settings to show plain text only, if you prefer it this
way.

Have you ever wondered why other people's posts are indented with '> 's?
That's what Outlook does automatically to plain text posts. In my mind that
makes things a lot more readable. But you seem to prefer this way...

2. your suggestion might work in this case but not in others,anyway i would
like to do it with reg-ex.

Instead of: someString.Replace("<title>", "<title>XXX ");
use: Regex.Replace(someString, "<title>", "<title>XXX ");

Note that both lines do exactly the same thing.

If that's not what you want, maybe you should rewrite your problem
descripton...

Niki

1. Please post plain-text messages only
2. Why don't you simply replace "<title>" with "<title>XXX ", with a command
like String.Replace?

Niki

Hi,

i know this forum is for dot-net framework, but regular expressions is part
of the framework, so i post my question here.

do you know of a code sample that can help me to replace the string
<title>hello</title>
with an addition to the inner text of the title tag so it will have an
addition of XXX for example:
<title>hello</title> will be
<title>XXX hello</title>
or
<title>home</title> will be
<title>XXX home</title>

how can i do it with dot-net using regular expressions.

if you can reference me to a regular expressions forum where i can submit
this question or answer this question it will be very helpful.

TIA!!!
z.
 
Back
Top