Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1058543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:02:31+00:00 2026-05-16T18:02:31+00:00

I found this very handy regular expression on regexlib.com, but i’m at a loss

  • 0

I found this very handy regular expression on regexlib.com, but i’m at a loss as to how to implement it in my app.

(?:(?:(?<Feet>\d+)[ ]*(?:'|ft)){0,1}[ ]*(?<Inches>\d*(?![/\w])){0,1}(?:[ ,\-]){0,1}(?<Fraction>(?<FracNum>\d*)\/(?<FracDem>\d*)){0,1}(?<Decimal>\.\d*){0,1}(?:\x22| in))|(?:(?<Feet>\d+)[ ]*(?:'|ft)[ ]*){1}

I tested it out using their online testing tool, and it does indeed do everything I need. Pasting it in as a parameter to ColdFusion’s REFind() predictably did not work and returned a useless error message.

I’m working in ColdFusion, so I have access to Java classes if needed. Answers in Java or ColdFusion would both be helpful.

A good sample string would be something like: 5′ 1/2″

EDIT

I need to make use of the groups in the regex in order to extract the data as opposed to simply using it to validate a string. I guess this means i should using REMatch()? Please excuse my lack of experience with regex!

EDIT 2

It seems that using REFind() with this expression:

(?:(?:(\\d+)[ ]*(?:'|ft)){0,1}[ ]*(\\d*(?![/\\w])){0,1}(?:[ ,\\-]){0,1}((\\d*)\\/(\\d*)){0,1}(\\.\\d*){0,1}(?:\\x22| in))|(?:(\\d+)[ ]*(?:'|ft)[ ]*){1}

is not finding matches for most of the test data i give it, including ones that return matches using the regexlib.com tester: 1ft 2-3/4 in, 2' 3 4/5", 3ft, 4', 5 in, 6", 7.125 in, 3ft 4.5 in

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:02:31+00:00Added an answer on May 16, 2026 at 6:02 pm

    The ?<foo> syntax is not supported in ColdFusion. I’m not familiar with that syntax, but it looks like it is being used to assign names to captured subexpressions. For example, the first subexpression is the number representing feet, so it has the ?<Feet> tag. You can remove those tags without affecting what the regex matches.

    I haven’t tested it, but all the other elements I see in that regex are supported in ColdFusion, so REFind() should work after removing all the ?<foo> tags. Accessing the subexpressions is of course supported by using the “returnsubexpressions” argument. See the standard CF docs on REFind().

    As an aside, the regex seems a little verbose. {0,1} is rare, as ? means the same thing. {1} is even rarer, as it is the default for groupings and thus can be omitted completely.

    ADDENDUM

    regex = "(?:(?:(\\d+)[ ]*(?:'|ft)){0,1}[ ]*(\\d*(?![/\\w])){0,1}(?:[ ,\\-]){0,1}((\\d*)\\/(\\d*)){0,1}(\\.\\d*){0,1}(?:\\x22| in))|(?:(\\d+)[ ]*(?:'|ft)[ ]*){1}";
    subs = REFind(regex,input,1,"True");
    if (subs.pos[1] eq 0) {
      found = "False";
    } else {
      found = "True";
      feet = Mid(input,subs.pos[2],subs.len[2]);
      inches = Mid(input,subs.pos[3],subs.len[3]);
      fraction = Mid(input,subs.pos[4],subs.len[4]);
      fracNum = Mid(input,subs.pos[5],subs.len[5]);
      fracDem = Mid(input,subs.pos[6],subs.len[6]);
      decimal = Mid(input,subs.pos[7],subs.len[7]);
      if (feet is "") {
        // Use the _other_ feet
        feet = Mid(input,subs.pos[8],subs.len[8]);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this wonderful NSManagedObjectID. This would be very good for referencing an Entity/NSManagedObject/NSEntityDescription,
I found this web site (photoblog) http://www.OneReaction.net/ and I am very curious how this
I have always found this to be a very useful feature in Visual Studio.
I've found it very difficult to find any existing documentation on this. What I'm
I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/ , but there isn't a lot of description around
I found this in an article on Multithreaded Apartments, but can’t find a definition
One trick I have found very handy in rails application programming is that class_eval
Reading this question I found this as (note the quotation marks) code to solve
I found this open-source library that I want to use in my Java application.
Just found this out, so i am answering my own question :) Use a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.