Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14752

Re: reg expression

From "Phil Hunt" <aaa@aaa.com>
Newsgroups comp.lang.javascript
Subject Re: reg expression
Date 2012-06-28 12:08 -0400
Organization Aioe.org NNTP Server
Message-ID <jsi02m$h27$1@speranza.aioe.org> (permalink)
References <jsfv2r$sks$1@speranza.aioe.org> <q1gnu759m1k9lbf8jdqqcam93edn4csn82@4ax.com> <XnsA080557FD310Deejj99@194.109.133.133> <9fudnXyX9bFYrnHSnZ2dnUVZ_qGdnZ2d@inch.com> <XnsA080AF8ECFF79eejj99@194.109.133.133>

Show all headers | View raw


Thank you guys for all your input.
I end up looping thru all the words(actually I am not looking for words, I 
am searching an array of string as someone is typing).

I am not that eager to delve into the crazy synax of RE, so looping is 
easier. I suppose I can use string.contains ?.

I am using MS visual studio to do some web pages. JScript is all I use, but 
it provides me with very little intellsense, What's up with that. What tools 
do you guys use that give you hints ? I hate to google or bother you guys 
with stupid questions



"Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote in message 
news:XnsA080AF8ECFF79eejj99@194.109.133.133...
> Spamless wrote on 28 jun 2012 in comp.lang.javascript:
>
>> On 2012-06-28, Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote:
>>> Gene Wirchenko wrote on 28 jun 2012 in comp.lang.javascript:
>>>
>>>> On Wed, 27 Jun 2012 17:48:15 -0400, "phil hunt" <a@abc.com> wrote:
>>>>
>>>>>In Jsctipt, I have
>>>>>
>>>>>re = new RegExp("one|two", "gi");
>>>>>
>>>>>"one three".search(re);  return an integer >-1, meaning it found a
>>>>>match
>>>>>
>>>>>My question is how do I set up the RegExp to match "one" AND "two". I
>>>>>though an & would do it, but no.
>>>>
>>>>      If you mean that the string contains both "one" and "two", the
>>
>> Wouldn't it be nice if you knew the order of the words?
>> Sometimes I ... split the text on word boundaries to get an array,
>> sort that (now the words are in order) join those up with a space
>> separator (now you have a new string with the same words in order)
>> and now you just search for "one.*two" (or with word boundaries
>> if you don't want subsequences of longer words).
>
> Wouldn't it be nice if you quoted me including something I wrote?
>
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress) 

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

reg expression "phil hunt" <a@abc.com> - 2012-06-27 17:48 -0400
  Re: reg expression Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2012-06-27 23:55 +0200
    Re: reg expression Dr J R Stockton <reply1226@merlyn.demon.co.uk.not.invalid> - 2012-06-28 19:08 +0100
      Re: reg expression Spamless <Spamless@Nil.nil> - 2012-06-29 08:22 -0500
        Re: reg expression "Phil Hunt" <aaa@aaa.com> - 2012-06-29 10:19 -0400
          Re: reg expression Spamless <Spamless@Nil.nil> - 2012-06-29 11:36 -0500
          Re: reg expression Gene Wirchenko <genew@ocis.net> - 2012-06-29 10:05 -0700
  Re: reg expression Gene Wirchenko <genew@ocis.net> - 2012-06-27 19:38 -0700
    Re: reg expression Gene Wirchenko <genew@ocis.net> - 2012-06-27 21:18 -0700
    Re: reg expression "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-28 06:24 +0000
      Re: reg expression Spamless <Spamless@Nil.nil> - 2012-06-28 05:36 -0500
        Re: reg expression "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-28 15:15 +0000
          Re: reg expression "Phil Hunt" <aaa@aaa.com> - 2012-06-28 12:08 -0400

csiph-web