Regular Expresions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi to all,

i did this regular expresion <!--!.*!--> that matchs all occurrences of type

<!--!Name!-->
<!--!Description!-->

and so on...

I would like to know the regular expression to get (for instance) for this
example, only the matches Name and Description without the start <!--! and
the end !-->
 
Name
Description

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 
Hi, Kevin....

i would need a regular expresion like <!--!.*!--> cause i dont know what
kind of data come... could be <!--!Name!--> <!--!Description!--> or
<!--!xxxxx!-->

Do you know how could be the regular expresion?
--
Thanks
Regards.
Josema


Kevin Spencer said:
Name
Description

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 
Hi to all,
i did this regular expresion <!--!.*!--> that matchs all occurrences
of type

<!--!Name!-->
<!--!Description!-->
and so on...

I would like to know the regular expression to get (for instance) for
this example, only the matches Name and Description without the start
<!--! and the end !-->

@"<!--!(?<text>.*?)!-->"

This will give you a named group.

usage:

Regex re = new Regex(@"...");
Match ma = re.Match(s);
if (ma.Success)
{
String text = ma.Groups["text"].Value;
....
}
 
Thanks a lot Karlsen, whas exactly the stuff that im searching for
--
Thanks
Regards.
Josema


Lasse Vågsæther Karlsen said:
Hi to all,

i did this regular expresion <!--!.*!--> that matchs all occurrences
of type

<!--!Name!-->
<!--!Description!-->
and so on...

I would like to know the regular expression to get (for instance) for
this example, only the matches Name and Description without the start
<!--! and the end !-->

@"<!--!(?<text>.*?)!-->"

This will give you a named group.

usage:

Regex re = new Regex(@"...");
Match ma = re.Match(s);
if (ma.Success)
{
String text = ma.Groups["text"].Value;
....
}

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[email protected]
PGP KeyID: 0x2A42A1C2
 
Sorry, Josema, I misunderstood your question. However, I can see that it has
been answered. Good luck!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

Josema said:
Hi, Kevin....

i would need a regular expresion like <!--!.*!--> cause i dont know what
kind of data come... could be <!--!Name!--> <!--!Description!--> or
<!--!xxxxx!-->

Do you know how could be the regular expresion?
 
Back
Top