DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Last post Author Topic: Launching URL files stored in the Windows file system  (Read 23,648 times)

mostlytyping

  • Supporting Member
  • Joined in 2015
  • **
  • Posts: 8
Re: Launching URL files stored in the Windows file system
« Reply #25 on: July 15, 2017, 06:28 AM »
That is best solved by changing the regex from nn(.*) to ^nn(.*) so that it only matches if the nn is at the START of the string.
Thank you. I was going go respond that in my case I don't actually want the anchor as often I am remembering a fragment of the name of the URL that could be anywhere in the string.
E.g. to find "Learning Elisp for better Emacs" I might simply type "elisp".

However, having tried it, it works, which seems to run counter to what I know about regexes...

EDIT: Wrong again, I am actually using "nn(^.*)" rather than "^nn(.*)" but this "nn(^.*)" still seems to get me the behaviour I want?

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 11,205
    • Participated in NANY Challenge Fourteen Times
    • Coding Snacks
    • Writer
    • Hardware Hacker
Re: Launching URL files stored in the Windows file system
« Reply #26 on: July 15, 2017, 01:55 PM »
Screenshot - 7_15_2017 , 9_51_34 AM.png
Screenshot - 7_15_2017 , 9_52_01 AM.png

Difference in the parsing (using RegexBuddy - I have to work with RegEx too much not to have a powerful parser.  Highly recommend it if you work with Regex)

Notice where the root is parsed. The expression is rooted, not the literal.  Not sure what Regex engine mouser is using, but you're correct- it shouldn't be working, because the inner portion should never satisfy that it's at the beginning of the string.  And it doesn't test right in RegexBuddy.

Original address: https://www.donationcoder.com/forum/index.php?topic=44045.0