Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use PithHelmet to allow simple URL typing' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use PithHelmet to allow simple URL typing
Authored by: koncept on Oct 29, '05 11:25:32AM
^(http://)*([^./]+)(/*)$
Regarding the pattern above, don't you have to escape the single "." in the range you want to negate? My basic understanding of regular expression patterns led me to believe that an un-escaped "." translates literally to "any single character" and NOT a period exclusively.

I am not able to install this application or test the following regular expression given my current version of Tiger for some reason, but I was thinking something like this:

Match:

^(http://)?([^.:/]+)(.+)?$

Replace:
http://www.$2.com$3

Again, I have very little experience in the regExp world, so if anything here needs cleaned up, I would appreciate learning from any feedback...

[ Reply to This | # ]
Use PithHelmet to allow simple URL typing
Authored by: koncept on Oct 29, '05 01:00:34PM
Weird. The escape was stripped. Same thing probably happened to the orig poster.
^(http://)?([^\.:/]+)(.+)?$


[ Reply to This | # ]
backslash weirdness
Authored by: sjk on Oct 29, '05 04:01:05PM

Happened to me the other day. I'd triple-backslashed to insert a backslash, saw it correctly in a post preview, fixed it again in the post text before submitting, but it was stripped in the actual post. Funky.



[ Reply to This | # ]
backslash weirdness
Authored by: dhirsch226 on Oct 30, '05 05:24:30PM
Yes, that seems to have happened to me when I submitted this. Perhaps some problem with Rob's data-flow pathway. The current URL field should look like this with no spaces, and with the correct symbols substituted for the all-caps words:
^(http:BACKSLASH/BACKSLASH/)*([^BACKSLASH.:BACKSLASH/]+)(BACKSLASH/*)$

(let's hope this works right)

[ Reply to This | # ]
Use PithHelmet to allow simple URL typing
Authored by: Bobson on Nov 01, '05 02:44:06PM

I'm pretty sure that a . in a character class (the brackets), means a '.' instead of it's usual meaning of 'any single character'. If you think about it, it doesn't make much sense to allow a character class to match one *anything*, or fail to match one *anything*...



[ Reply to This | # ]