Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Search array with pattern in Javascript

Search array with pattern in Javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptdata-structuresregexhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anish27patel
    wrote on last edited by
    #1

    Hello All I need to search pattern in Array list using Javascript. Like there is one Array which have five value like a[0] = 'apple' a[1] = 'car' a[2] = 'car1' a[3] = 'bike' a[4] = 'office' a[5] = 'computer' i want find those array list which are contain 'ca' character OUTPUT:- like In another array have contain two element like car and car1 can you please help me out how it possible in javascript? Thanks in Advance.

    Anish Patel

    M 1 Reply Last reply
    0
    • A anish27patel

      Hello All I need to search pattern in Array list using Javascript. Like there is one Array which have five value like a[0] = 'apple' a[1] = 'car' a[2] = 'car1' a[3] = 'bike' a[4] = 'office' a[5] = 'computer' i want find those array list which are contain 'ca' character OUTPUT:- like In another array have contain two element like car and car1 can you please help me out how it possible in javascript? Thanks in Advance.

      Anish Patel

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      anish27patel wrote:

      In another array have contain two element like car and car1 can you please help me out how it possible in javascript?

      var result = new Array();
      for(var count = 0; cout < mylist.length; count++)
      {
      if(mylist[count].match("ca"))
      result[result.length + 1] = mylist[count];
      }

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      A 1 Reply Last reply
      0
      • M Manas Bhardwaj

        anish27patel wrote:

        In another array have contain two element like car and car1 can you please help me out how it possible in javascript?

        var result = new Array();
        for(var count = 0; cout < mylist.length; count++)
        {
        if(mylist[count].match("ca"))
        result[result.length + 1] = mylist[count];
        }

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        A Offline
        A Offline
        anish27patel
        wrote on last edited by
        #3

        Thank you

        Anish Patel

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups