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

  • Home
  • SEARCH
  • 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 8913629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:30:31+00:00 2026-06-15T04:30:31+00:00

I need two regular expressions, on that matches anything that ends with 10PL that

  • 0

I need two regular expressions, on that matches anything that ends with 10PL that is (a single whitespace) (any integer) (the string PL in caps) (line terminates). I tried the following but none of them works. For eg.

var str="Visit W3Schools 45PL";  // should match this
var str1="Visit W3Schools 45PL Other";  // should NOT match this
var str2 = "Any Random value 133PL" // should match this
var str3 = "Any Random value 133Pl" // should NOT match this

The other should match 21.323X230 (a single whitespace) (any floating value) (the word X in caps) (any other floating point value) (line terminates). For eg.

var test="Visit W3Schools 4X5";  // should match this
var test1="Visit W3Schools 4X5PL Other";  // should NOT match this
var test2 = "Any Random value 13.270X46.96" // should match this
var test3 = "Any Random value 13.21X12.36 " // should NOT match this, as last word is white space

I tried the following pattern (for the first one (the PL one)).

var patt1=/\s+\d+/PL/g;
var patt2 = /[ ]+[0-9]+/PL/g;
document.write(patt1.test(str));
document.write(patt2.test(str));
document.write(patt1.test(str1));
document.write(patt2.test(str1));
document.write(patt1.test(str2));
document.write(patt2.test(str2));
document.write(patt1.test(str3));
document.write(patt2.test(str3));

result was all null (document.write didn’t wrote anything). So, can anyone help me figure out regex for these two patterns?

  • 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-15T04:30:32+00:00Added an answer on June 15, 2026 at 4:30 am

    You have a syntax error in your pattern – the / in the middle of the regex is

    • not needed (there is no literal slash you want to match, is there?), and
    • confusing to the regex engine because it interprets it as the ending regex delimiter. It then tries to interpret PL/g as regex modifiers (which of course doesn’t work).

    Also, you’re not telling the regex that it should match that pattern only at the end of a line. So try this:

    var patt1 = / \d+PL$/gm;
    

    $ matches (together with the m modifier) the end of a line. Without that modifier, it would only match the end of the string.

    For the second one:

    var patt2 = / \d+(?:\.\d+)?X\d+(?:\.\d+)?$/gm;
    

    Also, please don’t visit W3Schools. It’s one of the most error-ridden places on the internet. If you don’t believe me, check out http://w3fools.com.

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

Sidebar

Related Questions

I need a regular expression that matches two virtual folders; the first and the
I need to find attribute values in an ASPX file using regular expressions. That
I need a library which will take in two regular expressions and determine whether
I'm trying to figure out a regular expression in JS that matches between two
I need an regular expression that matches A.*C only if there's no B in
I need some help writing a regular expression that matches this: an opening square
I need two regular expressions to identify if .. then .. else .. endif
I need a regular expression to extract from two types of URIs http://example.com/path/to/page/?filter http://example.com/path/to/?filter
I have a form that has a group of 3 text_fields. I need two
I have a need for two slightly different classes, that have the same members,

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.