Connecting Tech Pros Worldwide Help | Site Map

Regular expression to identify HTMLEncoded string

Gabriela
Guest
 
Posts: n/a
#1: Nov 3 '08
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.
Evertjan.
Guest
 
Posts: n/a
#2: Nov 3 '08

re: Regular expression to identify HTMLEncoded string


Gabriela wrote on 03 nov 2008 in microsoft.public.inetserver.asp.general:
Quote:
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.
Quote:
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)
Anthony Jones
Guest
 
Posts: n/a
#3: Nov 4 '08

re: Regular expression to identify HTMLEncoded string


"Gabriela" <frohlinger@yahoo.comwrote in message
news:4954b993-5b7b-4e47-a6fc-664decfedef5@40g2000prx.googlegroups.com...
Quote:
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

Closed Thread


Similar ASP / Active Server Pages bytes