Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

RE: Fun Regex Exercise

by dchetlin (Friar)
on Oct 25, 2000 at 16:31 UTC ( #38344=note: print w/replies, xml ) Need Help??

in reply to Fun Regex Exercise

/me tries to figure out how to do a spoiler in web-space...

Spoiler follows!...



or, if I can use backreferences (wasn't clear if grouping meant _only_ grouping):



Replies are listed 'Best First'.
How to present spoilers :-)
by tilly (Archbishop) on Oct 26, 2000 at 05:43 UTC
    Actually HTML has a wonderful way to do spoilers, an example is below. Highlight it if you actually need an explanation of the trick.


    The trick is that you write a table with the font and the background color the same. When someone highlight's it they can read the spoiler, but otherwise they cannot.

    In this case I did it like this:

    <table><tr><td bgcolor=#000000><font color=#000000> put text here and then </font><td></tr></table>
    Unfortunately links show through because the rules for the HTML here don't include (that I saw at least) a way to control the color of an HREF. Which is why the link is down there and not in here. :-)

    Wish I could claim it was my idea, but one of the folks at IWETHEY (namely CRConrad) came up with it.

      I am the ultimate spoiler

      The trick for including links of different color, aside from changing body attributes is to do the following:
      <a href="/"> <font color="#000000"> slick </FONT> </a>
      I'm a slick one ain't i?

      Disclaimer: Don't blame. It came from inside the void
      perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

      <table><tr><td bgcolor=#000000><font color=#000000> put text here and then </font><td></tr></table>
      If you're gonna do that, at least make it legal HTML by putting the needed quotes around the attributes!

      -- Randal L. Schwartz, Perl hacker

      You can solve the problem with the colour of the hyperlinks by using Cascading Style Sheets.

      I've changed the colours on my homepage and also removed the underline from the links.

      Update: Putting underlines for links is sooo ugly! :)


      Just so folks know should they stumble on this node there is now support for <spoiler> tags in PM. They can be configured to render just like this too. :-) IOW, please DONT follow the advice here from tilly, just use the correct tags.


RE: RE: Fun Regex Exercise
by japhy (Canon) on Oct 25, 2000 at 16:44 UTC
    Bravo (or brava, depending...). My solution was different, but could (and should) have been optimized into yours. Mine uses the notion that any matching string looks like a series of strings like "11..1100..00" concatenated, with a string of 1's at the end. (Or vice-versa, with 0's...) But yours is far simpler -- in fact, it states the very fact: if there's a 1 (or 0) at both ends, the string will succeed. Oh, and no backreferences, but that's ok.

    Here's mine. It seems like even more of a behemoth now...
    "Ewww," Tom said sheepishly.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://38344]
and the fog begins to lift...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2018-05-27 00:25 GMT
Find Nodes?
    Voting Booth?