Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Regular expression to identify HTMLEncoded string

Reply
Thread Tools

Regular expression to identify HTMLEncoded string

 
 
Gabriela
Guest
Posts: n/a
 
      11-03-2008
Hi,
I need help with writing a regexp that identifies HTML encoded
strings.
The problem occurred because I have a field in the DB, that contains
regular ASCII chars, as well as HTMLencoded strings (e.g.:
זאת לא).
Is there a quick way to determine which strings are HTML encoded?
Thanks,
Gabi.
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      11-03-2008
Gabriela wrote on 03 nov 2008 in microsoft.public.inetserver.asp.general:

> Hi,
> I need help with writing a regexp that identifies HTML encoded
> strings.
> The problem occurred because I have a field in the DB, that contains
> regular ASCII chars, as well as HTMLencoded strings (e.g.:
> זאת לא).


These all look to me like regular ASCII chars,
as there are no irregular ASCII chars.

> Is there a quick way to determine which strings are HTML encoded?


var bolResult = /\&\d{4};/.test(str)

perhaps?

bd way, a javascript string is in unicode, and can contain non-ASCII chars.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      11-04-2008
"Gabriela" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I need help with writing a regexp that identifies HTML encoded
> strings.
> The problem occurred because I have a field in the DB, that contains
> regular ASCII chars, as well as HTMLencoded strings (e.g.:
> זאת לא).
> Is there a quick way to determine which strings are HTML encoded?


Are you sure their not all HTML encoded? (That is, are there any that
contain characters that would normally be encoded but have not been?).
Do you know how they came to have this encoding?
Are there any HTML specific entities such as &nbsp; or are they from the
simple XML set.
What is the DB fields data type?

Why do you want to detect, is it because you want to convert the string
back?

If there are no HTML specific entities and its true that there are no values
where character that would normally be encoded aren't, then:-

Dim oXML : Set oXML = CreateObject("MSXML2.DOMDocument.3.0")
oXML.LoadXML "<root>" & sFieldValue & "</root>"

sDecoded = oXML.documentElement.text

--
Anthony Jones - MVP ASP/ASP.NET

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
HtmlEncoded Usernames in ASP.NET 2 Membership DB? =?Utf-8?B?SnVsaWU=?= ASP .Net 0 10-09-2007 08:48 AM
Can I quickly identify what part of a conditional regular expression matches? Alf McLaughlin Perl Misc 9 02-10-2006 04:18 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments