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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:55:10+00:00 2026-05-26T10:55:10+00:00

How to search text on javascript. var v=20; str = The rain 20 in

  • 0

How to search text on javascript.

var v=20;
str = "The rain 20 in SPAIN stays mainly in the plain";
var patt1=/ain  v/gi;
var n = str.match(patt1);
alert(n);

i am trying it but not getting any result.
Where am i wrong, any buddy can you please help me out.

  • 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-26T10:55:11+00:00Added an answer on May 26, 2026 at 10:55 am
    var v = 20; // Variable part of search query
    var str = "The rain 20 in SPAIN stays mainly in the plain"; // String to search
    var n = str.match('ain ' + v); // The searching, returns null if not found or the matches found. Notice the 'ain' string has been added (this can of course be changed)
    
    if(n != null){ // if not null
       alert(n + ' found!');
    }else{ // if null
       alert(v + ' not found...');   
    }
    

    I think this will help you out: http://jsfiddle.net/xFeAH/

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

Sidebar

Related Questions

i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
<script type=text/javascript> var geo = new GClientGeocoder(); function showAddress() { var search = document.getElementById(search).value;
how to modify this code if i want search JD from var str=KD-S35JWD ..i
<link rel=stylesheet type=text/css href=jquery-ui-1.8.2.custom.css /> <script src=jquery-1.4.2.min.js type=text/javascript></script> <script src=jquery-ui-1.8.2.custom.min.js type=text/javascript></script> <body> Search: <input
i have this code for get data from textfield: <script type=text/javascript> var mod=document.getElementById(mod).value; ajax(mod);
What is wrong with this code? <script type=text/javascript> var urlquery = location.href; var urlparts
Let us start with the Javascript-code: <script type=text/javascript> var parentWindowLocation = ''; // closes
<script type=text/javascript> function addbutton() { var o = document.getElementsByTagName('li'); for(var i=0;i<o.length;i++) { var keyword=
0. <script type=text/javascript> 1. var games = new GameList(bets); 2. games = games.getGames(); //an
I have the below code in my jqgrid <script type=text/javascript> jQuery(document).ready(function() { var grid

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.