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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:44:26+00:00 2026-05-15T06:44:26+00:00

i have this code: <script type=text/javascript> var str=KD-R35H2UND; var patt1=/[G|T|EE|EJU].*D/i; document.write(str.match(patt1)); </script> by using

  • 0

i have this code:

<script type="text/javascript">
var str="KD-R35H2UND";
var patt1=/[G|T|EE|EJU].*D/i;
document.write(str.match(patt1));
</script>

by using code at var patt1=... i can show like this:

if i type KD-R35ED => SHOW ED
KD-R35UND => UND
KD-R35JD => JD
KD-R35TJD => TJD
KD-R35EED=> EED

my problem is: if i type KD-R35GD it can show GD but if KD-R35D it can’t show anything..how to make it works?

  • 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-15T06:44:26+00:00Added an answer on May 15, 2026 at 6:44 am

    b* means “match zero or more occurences of b“.

    . means “match any character except newline”.

    [EE|EJU] means “match an E, a |, a J or a U“.

    .* means “match any character except newline zero or more times”.

    D means “match a D“.

    So the regex is doing what you asked it to do.

    From the examples you provided in your question, I’m guessing that the actual rules should be:

    1. String starts with KD-R35.
    2. Then any number of alphanumeric characters may follow, as long as
    3. there is an E, a J or a U among them, and
    4. the string ends in D.

    These rules, as a regex, read:

    ^         # start of string
    KD-R35    # literal text
    (         # start of capturing group
      \w*     # any number of alphanumeric characters
      [EJU]   # at least one of E, J, or U
      \w*     # any number of alphanumeric characters
      D       # a D
    )         # end of capturing group
    $         # end of string
    

    or, in JavaScript:

    match = subject.match(/^KD-R35(\w*[EJU]\w*D)$/i);
    if (match != null) {  // successful match
        mytext = match[1] // capturing group 1
    } else {
        // Match attempt failed
    }
    

    I’m assuming that upper/lowercase don’t matter.

    EDIT: Erm, your new edit changes the rules. It seems that any string is allowed as long as it starts with KD-R35 and ends in D. In this case, the regex would simply be /^KD-R35(\w*D)$/i.

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

Sidebar

Related Questions

i have regex code: <script type=text/javascript> var str = kw-xr55und; var patt1 = /[T|EE|EJU].*D/i;
I have this code: <script type=text/javascript> $(document).ready(function() { var url = https://graph.facebook.com/search?q=cinema&type=post; $.ajax({ type:
i have this code: <script type=text/javascript> $(document).ready(function() { function doAjax(url) { $(#customForm).submit(function() { var
I have this code: <script type=text/javascript> function js() { var getJs = document.getElementById(jogo); if
I have this code: <script type=text/javascript> var maxLength=10; function charLimit(el) { if (el.value.length >
I have this code running great in ff, opera and chrome: <script type=text/javascript> $(document).ready(function(){
I have this code: <script type=text/javascript> var loader = #loader; $(function() { $(#selUsers).change(function() {
i have code like this: <script type=text/javascript> var _gaq = _gaq || []; _gaq.push(['_setAccount',
I have this code: <script type=text/javascript> function showTotal(form, totalEl) { var el, els =
I have this code <title>Welcome</title> <head> <script type=text/javascript> var id = ...; var sessionCount

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.