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


Groups > comp.lang.javascript > #18955 > unrolled thread

Help creating regex

Started by"Joey@still_Learning.invalid" <Joey@still_Learning.invalid>
First post2013-03-20 11:47 -0700
Last post2013-04-29 01:40 -0700
Articles 2 on this page of 22 — 7 participants

Back to article view | Back to comp.lang.javascript


Contents

  Help creating regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-03-20 11:47 -0700
    Re: Help creating regex Danny <dann90038@gmail.com> - 2013-03-20 12:08 -0700
      Re: Help creating regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-03-20 12:18 -0700
    Re: Help creating regex Jim T. <x@y.z> - 2013-03-20 15:11 -0500
      Re: Help creating regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-03-20 12:19 -0700
        Re: Help creating regex Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-03-21 20:20 +0000
    Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-27 10:56 -0700
      Re: Help creating 'simple' regex JJ <duh@nah.meh> - 2013-04-28 02:27 +0700
        Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-27 16:39 -0700
        Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-28 09:36 -0700
          Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-29 01:41 -0700
      Re: Help creating 'simple' regex Stefan Weiss <krewecherl@gmail.com> - 2013-04-27 22:27 +0200
        Re: Help creating 'simple' regex Stefan Weiss <krewecherl@gmail.com> - 2013-04-27 22:34 +0200
        Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-27 16:39 -0700
          Re: Help creating 'simple' regex "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-04-28 09:20 +0200
            Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-28 01:22 -0700
              Re: Help creating 'simple' regex Stefan Weiss <krewecherl@gmail.com> - 2013-04-28 11:32 +0200
                Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-28 09:53 -0700
                  Re: Help creating 'simple' regex Stefan Weiss <krewecherl@gmail.com> - 2013-04-28 19:41 +0200
                    Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-28 23:51 -0700
              Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-28 09:14 -0700
              Re: Help creating 'simple' regex "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2013-04-29 01:40 -0700

Page 2 of 2 — ← Prev page 1 [2]


#19518 — Re: Help creating 'simple' regex

From"Joey@still_Learning.invalid" <Joey@still_Learning.invalid>
Date2013-04-28 09:14 -0700
SubjectRe: Help creating 'simple' regex
Message-ID<phiqn8lgh8noi94l6vo23e17flc4p99d8d@4ax.com>
In reply to#19513
Joey@still_Learning.invalid wrote:

>Evertjan. wrote:
>
>>Joey@still_Learning.invalid wrote on 28 apr 2013 in comp.lang.javascript:
>>
>>>>  var found = testString.indexOf("testing") > -1;
>>
>>[..]
>>
>>> I can't use indexOf(), because there are spaces before, after and withing
>>> the string.
>>
>>Invalid argument.
>
>I don't agree. If the use inputs nothing, indexOf() will kick back a true,
>when indeed the input is false.

Additionally...were I to use indexOf() and the user entered test instead
of testing, I'd see a incorrect true response. That's what drove me to try
a regular expression to find a perfect match.

I'm very interested in why you believe my argument to be invalid. (Please)
-- 
Joey

[toc] | [prev] | [next] | [standalone]


#19527 — Re: Help creating 'simple' regex

From"Joey@still_Learning.invalid" <Joey@still_Learning.invalid>
Date2013-04-29 01:40 -0700
SubjectRe: Help creating 'simple' regex
Message-ID<abcsn8pg27625clds8tf9cs8vpb0gucq4v@4ax.com>
In reply to#19513
Joey@still_Learning.invalid wrote:
>Joey@still_Learning.invalid wrote:
>>Evertjan. wrote:
>>>Joey@still_Learning.invalid wrote on 28 apr 2013 in comp.lang.javascript:
>>>
>>>>>  var found = testString.indexOf("testing") > -1;

>>>> I can't use indexOf(), because there are spaces before, after and withing
>>>> the string.
>>>
>>>Invalid argument.
>>
>>I don't agree. If the use inputs nothing, indexOf() will kick back a true,
>>when indeed the input is false.

I was wrong! Thanks...you got me thinking (for a change it seems) 
>
>Additionally...were I to use indexOf() and the user entered test instead
>of testing, I'd see a incorrect true response. That's what drove me to try
>a regular expression to find a perfect match.
>
>I'm very interested in why you believe my argument to be invalid. (Please)

The answer is so simple, I'm embarrassed having asked the question. :-)

firstString = document.form.elements["firstString"].value; //'Mary Smith'
testString = document.form.elements["testString"].value;
//Mary Smith-00003.img

adjName = testString.indexOf("-00");
endName = imageName0.substr(0,adjName);
testNames = endName.indexOf(firstString);
if (testNames != -1 && firstString == endName)  {
	alert("Identical")
}

From here, it's a simple task of identifying why the names are not
identical and alerting the user. With appropriate validation on
firstString input, I can filter out erroneous firstString inputs, e.g.,
double spaces. I have no control on validating testString, except the
knowledge its form is 'userinput-nnnnnm.img.'

The word doh! comes to my mind. 

Thank you.
-- 
Joey

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web