Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Regex weirdness  (Read 958 times)

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Regex weirdness
« on: January 14, 2018, 04:12:10 PM »

I have a regex which works, it matches test data as expected:
    [-:;]

ie match hyphen, colon or semicolon. Despite the special meaning of hyphen to indicate ranges, I believe this is ok because the hyphen is at the start. Anyway, it does behave as expected. As a sanity check I looked at it using this superb tool, which I use a lot: https://regex101.com

So, I later wanted to alter it for a different circumstance to not try and match hyphens:
    [:;]

but for some unknown reason this now does not match against my input. The tool says it should work against my exact data.

My question: Is there something wrong about this second form?

Confession: The above isn’t the entire actual regex, the real thing and also its test data are quite long but this shows the only change made to the regex, so I reduced it down for ease of presentation. Explanation as to why this should be fair is as follows.

These alternative forms both do work though

    [;:]
    [\:;]


I am using the Workflow interpreted language for iOS. These regexes are in a program that I have written in Workflow.
« Last Edit: January 14, 2018, 04:40:49 PM by Weaver »
Logged
 

anything