mapsedge: Me at Stone Bridge Coffee House (Titanic)
[personal profile] mapsedge
Is there a regular expression that would allow me to replace any character above ASCII-128 in a string with the HTML entity equiv, an in:

replace in {string}:  ascii-X with &#X; where X between 128 and 255

It would save a nested loop if I could figure out how to do it in one statement.

Date: 2008-08-14 15:48 (UTC)
From: [identity profile] akaashben.livejournal.com
I don't see how to do it without a loop, since you have to examine each character in turn to determine its ascii value.

Even if you could convert the entire string to its component ascii values before looking at it, you would still have to break it up in to 3-digit chunks and examine each one before converting it back. Running a regex search on 3-digit chunks of that would very likely mess it all up.

June 2023

S M T W T F S
    123
45678910
11121314151617
1819 2021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 28th, 2026 18:58
Powered by Dreamwidth Studios