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 7059043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:11:06+00:00 2026-05-28T04:11:06+00:00

EDIT: A working regex (take the second group): (^|[ ,\t\n]+)([0-9\\.]+)($|[ ,\t\n]+) Original post: I’m

  • 0

EDIT: A working regex (take the second group):

(^|[ ,\t\n]+)([0-9\\.]+)($|[ ,\t\n]+)

Original post:

I’m new to Haskell, trying to use Text.Regex (from regex-compat) to extract float values from a string. I want my regex to match any series of numbers and periods that is buffered by at least one separator character to the left and the right. This is what I wrote:

regex = "[^ \t\n,]+([0-9\\.])+[$ \t\n,]+"

EDIT: I originally thought this worked properly in Scala, but I now believe I simply got lucky with my test strings. This does not work in Haskell. An example:

matchRegexAll (mkRegex regex) " 12.34 "

yields

Just (" ","12.34 ","",["4"])

when it seems to me it should yield

Just (""," 12.34 ","",["12.34"])

Another example:

matchRegexAll (mkRegex regex) "12.34"

yields

Nothing

when it I think it should yield

Just ("","12.34","",["12.34"])

I’m guessing the parser treats “^” and “$” differently that does the Scala parser, but that’s all I’ve got.

  • 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-28T04:11:06+00:00Added an answer on May 28, 2026 at 4:11 am

    Inside a character class like [^ \t\n,], normal regex metacharacters (such as ^ and $) lose their special meaning; they match themselves instead.1 Something like (^|[ \t\n,]) should do what you want.

    I’m surprised your regex works in Scala; I’ve never seen a regex implementation that doesn’t behave in this manner.

    1 Although as FlopCoder points out, ^ at the start of a character class actually negates it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im using the WPFToolkit's DataGrid and im trying to get an edit button working,
I'm trying to get edit-and-continue working with Visual Studio 2008 with an ASP.Net MVC
EDIT: I have edited my post... Working on a project (c#), I have a
I've got the following regex that was working perfectly until a new situation arose
Hi i was trying to filter a large of text file using Regex.Split with
My regex is not working properly. I'm showing you before regex text and after
Using Ruby I'm trying to split the following text with a Regex ~foo\~\=bar =cheese~monkey
I'm trying to use a regex pattern found on this thread in scala: Strip
I won't want to have edit any working sets. I just want a way
EDIT: See my working code in the answers below. In brief: I have 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.