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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:52:54+00:00 2026-06-07T23:52:54+00:00

These sentences work SELECT (regexp_matches(‘Euroschinus Hoff+300′::text, E'(Euroschinus Hoff[\+])([0- 9]+)’::text)::text[])[1]::text as counter select array_scientificname from

  • 0

These sentences work

SELECT (regexp_matches('Euroschinus Hoff+300'::text, E'(Euroschinus Hoff[\+])([0- 9]+)'::text)::text[])[1]::text as counter 
select array_scientificname from simple_cal where array_scientificname ~ 'Semecarpus'

But, if there are some parenthesis, never mind where in the text, both don’t work

SELECT (regexp_matches('Euroschinus (testing) Hoff+300'::text, E'(Euroschinus (testing)  Hoff[\+])([0-9]+)'::text)::text[])[1]::text as counter 
select array_scientificname from simple_cal where array_scientificname ~  'Semecarpus(test)'

I just want to get, the text. There is no defined pattern for () , can be anywhere on the text.

I noticed that using \ before parenthesis it does the trick (see below), but this is not practical at all. I think i should include somewhere that () are allowed in the string…

SELECT (regexp_matches('Euroschinus (testing) Hoff+300'::text, E'(Euroschinus jaffrei \\(testing\\) Hoff[\+])([0-9]+)'::text)::text[])[1]::text as counter
  • 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-06-07T23:52:56+00:00Added an answer on June 7, 2026 at 11:52 pm

    This doesn’t return anything:

    SELECT (regexp_matches(
             'Euroschinus (testing) Hoff+300'::text
         , E'(Euroschinus jaffrei \\(testing\\) Hoff[\\+])([0-9]+)')::text[])[1]::text;
    

    This would, after removing the string jaffrei from the pattern:

    SELECT (regexp_matches(
             'Euroschinus (testing) Hoff+300'::text
         , E'(Euroschinus \\(testing\\) Hoff[\\+])([0-9]+)')::text[]);[1]::text
    

    Simplify the regexp, loose the pointless character class:

    SELECT (regexp_matches(
             'Euroschinus (testing) Hoff+300'::text
         , E'(Euroschinus \\(testing\\) Hoff\\+)([0-9]+)')::text[])[1]::text;
    

    If you are bothered by having to add backslashes, try the setting standard_conforming_strings (Default since PostgreSQL 9.1) and use a plain string instead of a Posix escape sequence:

    SELECT (regexp_matches(
             'Euroschinus (testing) Hoff+300'::text
         , '(Euroschinus \(testing\) Hoff\+)([0-9]+)')::text[])[1]::text;
    

    But if you are only interested in the first hit, you’d rather use substring() to begin with. Capturing parentheses pick the string you want:

    SELECT substring('Euroschinus (testing) Hoff+300'
                  , '(Euroschinus \(testing\) Hoff\+)[0-9]+');
    

    Finally, if you are bothered by the mere existence of () in the string (??), remove them:

    SELECT substring(translate('Euroschinus (testing) Hoff+300', '()', '')
                            , '(Euroschinus testing Hoff\+)[0-9]+');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would be the appropriate regex to get the last word in these sentences:
I have a text file that has some invalid byte sequences. Emacs renders these
I wish to split text into sentences. Can anyone help me? I also need
I have an access database with these tables: - sequences: it describes the sequences
I need help identifying what these ANSI escape sequences represent. I'm currently filtering/evaluating the
These are the memory leaks that I am getting: http://twitter.com/AWEHOFFICIAL/status/221182174811004929/photo/1/large
These days I design some algorithms in python, but find first two greatest value
These tools basically input a grammar and output code which processes a series of
These are for two separate codecademy exercises. They both pass me but I'm not
These days, we encountered a strange problem, some of our solr apps on tomcat

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.