The example above will do
<Emphasis type="Bold">...</Emphasis> to <Bold>...</Bold>
<Emphasis type="Italic">...</Emphasis> to <Italic>...</Italic>
etc.

If you need some tags to be the full word (ie: <bold>) and others to
be just he first letter (ie: <i>) then I would recommend a second
update to replace any full words with just their letter.

Eg:
htmltags = 
Regex.Replace(htmltags,"<(/?)Italic(.*)>","<$1I$2>",RegexOptions.IgnoreCase);

That will replace <Italic>...</Italic> with <I>...</I>

And, for example, underline/u, it would be:
htmltags = 
Regex.Replace(htmltags,"<(/?)underline(.*)>","<$1u$2>",RegexOptions.IgnoreCase);

Hope that makes sense?

On 11/15/06, mira mira <[EMAIL PROTECTED]> wrote:
> I need to replace the <Emphasis type="Bold">(.+?)</Emphasis>
> with <Bold>$1</Bold>
> Italic for<I>$1</I> etc.
>
> Thanks
>
> thanks
>
>
> >I don't have a C# compiler to test it with, but give this a try:
> >
> >while (Regex.IsMatch(htmltags, "<Emphasis type=\"([a-z]+)\">",
> >RegexOptions.IgnoreCase))
> >{
> >       htmltags = Regex.Replace(htmltags, "<Emphasis
> >type=\"([a-z]+)\">(([^<]|<(?!Emphasis))+?)</Emphasis>", "<$1>$2</$1>",
> >RegexOptions.IgnoreCase);
> >}
> >
> >
> >On 11/15/06, mira mira <[EMAIL PROTECTED]> wrote:
> >>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:998
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to