Thread overview
help with RegExp not matching [D1]
Nov 22, 2009
jicman
Nov 23, 2009
jicman
Nov 23, 2009
jicman
Nov 23, 2009
g
Nov 23, 2009
jicman
November 22, 2009
Greetings and salutations.

I am having trouble with this regular expression.  I tried a few things and nothing.  Any help will be greatly appreciated.  Here is the program...

import std.stdio;
import std.regexp;


void main()
{
  char[] l, s, s0, str0;

  s = ";p=SomeCompany;l=USA0300MS01-091110184958Z-3076Delivery:";
  str0 = r"p=SomeCompany;l=[a-zA-Z0-9]+\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
  str0 = r"\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
  if (RegExp(str0).find(s) >= 0) // found ;p=XeroxCorp;l=USA0300MS01-091110184958Z-3076
  {
    writefln("Found it...");
  }
  else
    writefln("Not found...");
}

18:16:05.94>build -I..;c:\D\dmd\import regexp1.d

18:21:13.68>regexp1
Not found...

thanks for the help.

josé
November 23, 2009
jicman Wrote:

> Greetings and salutations.
> 
> I am having trouble with this regular expression.  I tried a few things and nothing.  Any help will be greatly appreciated.  Here is the program...
> 
> import std.stdio;
> import std.regexp;
> 
> 
> void main()
> {
>   char[] l, s, s0, str0;
> 
>   s = ";p=SomeCompany;l=USA0300MS01-091110184958Z-3076Delivery:";
>   str0 = r"p=SomeCompany;l=[a-zA-Z0-9]+\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
>   str0 = r"\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
>   if (RegExp(str0).find(s) >= 0) // found ;p=XeroxCorp;l=USA0300MS01-091110184958Z-3076
>   {
>     writefln("Found it...");
>   }
>   else
>     writefln("Not found...");
> }
> 
> 18:16:05.94>build -I..;c:\D\dmd\import regexp1.d
> 
> 18:21:13.68>regexp1
> Not found...
> 
> thanks for the help.
> 
> josé

Does anybody hve any ideas?

thanks.
November 23, 2009
jicman Wrote:

> jicman Wrote:
> 
> > Greetings and salutations.
> > 
> > I am having trouble with this regular expression.  I tried a few things and nothing.  Any help will be greatly appreciated.  Here is the program...
> > 
> > import std.stdio;
> > import std.regexp;
> > 
> > 
> > void main()
> > {
> >   char[] l, s, s0, str0;
> > 
> >   s = ";p=SomeCompany;l=USA0300MS01-091110184958Z-3076Delivery:";
> >   str0 = r"p=SomeCompany;l=[a-zA-Z0-9]+\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> >   str0 = r"\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> >   if (RegExp(str0).find(s) >= 0) // found ;p=XeroxCorp;l=USA0300MS01-091110184958Z-3076
> >   {
> >     writefln("Found it...");
> >   }
> >   else
> >     writefln("Not found...");
> > }
> > 
> > 18:16:05.94>build -I..;c:\D\dmd\import regexp1.d
> > 
> > 18:21:13.68>regexp1
> > Not found...
> > 
> > thanks for the help.
> > 
> > josé
> 
> Does anybody hve any ideas?
> 
> thanks.

Never mind... sorry about this.

josé
November 23, 2009
jicman Wrote:

> jicman Wrote:
> 
> > jicman Wrote:
> > 
> > > Greetings and salutations.
> > > 
> > > I am having trouble with this regular expression.  I tried a few things and nothing.  Any help will be greatly appreciated.  Here is the program...
> > > 
> > > import std.stdio;
> > > import std.regexp;
> > > 
> > > 
> > > void main()
> > > {
> > >   char[] l, s, s0, str0;
> > > 
> > >   s = ";p=SomeCompany;l=USA0300MS01-091110184958Z-3076Delivery:";
> > >   str0 = r"p=SomeCompany;l=[a-zA-Z0-9]+\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> > >   str0 = r"\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> > >   if (RegExp(str0).find(s) >= 0) // found ;p=XeroxCorp;l=USA0300MS01-091110184958Z-3076
> > >   {
> > >     writefln("Found it...");
> > >   }
> > >   else
> > >     writefln("Not found...");
> > > }
> > > 
> > > 18:16:05.94>build -I..;c:\D\dmd\import regexp1.d
> > > 
> > > 18:21:13.68>regexp1
> > > Not found...
> > > 
> > > thanks for the help.
> > > 
> > > josé
> > 
> > Does anybody hve any ideas?
> > 
> > thanks.
> 
> Never mind... sorry about this.
> 
> josé

don't get disappointed. It happens in every community, that som answeres are not answred or answered in time. I may be because is a bit offtopic, also can be if "what is the problem with this [cryptic|strange1 whatever code] code", or simpley beacuse nones know what to say.
In your case, i would say that be more explicit and don't be like "resolve my homework now".
just general recomendations, and be patient.
best regards.
g
November 23, 2009
g Wrote:

> jicman Wrote:
> 
> > jicman Wrote:
> > 
> > > jicman Wrote:
> > > 
> > > > Greetings and salutations.
> > > > 
> > > > I am having trouble with this regular expression.  I tried a few things and nothing.  Any help will be greatly appreciated.  Here is the program...
> > > > 
> > > > import std.stdio;
> > > > import std.regexp;
> > > > 
> > > > 
> > > > void main()
> > > > {
> > > >   char[] l, s, s0, str0;
> > > > 
> > > >   s = ";p=SomeCompany;l=USA0300MS01-091110184958Z-3076Delivery:";
> > > >   str0 = r"p=SomeCompany;l=[a-zA-Z0-9]+\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> > > >   str0 = r"\-\d\d\d\d\d\d\d\d\d\d\d\dZ\-d\d\d\d";
> > > >   if (RegExp(str0).find(s) >= 0) // found ;p=XeroxCorp;l=USA0300MS01-091110184958Z-3076
> > > >   {
> > > >     writefln("Found it...");
> > > >   }
> > > >   else
> > > >     writefln("Not found...");
> > > > }
> > > > 
> > > > 18:16:05.94>build -I..;c:\D\dmd\import regexp1.d
> > > > 
> > > > 18:21:13.68>regexp1
> > > > Not found...
> > > > 
> > > > thanks for the help.
> > > > 
> > > > josé
> > > 
> > > Does anybody hve any ideas?
> > > 
> > > thanks.
> > 
> > Never mind... sorry about this.
> > 
> > josé
> 
> don't get disappointed. It happens in every community, that som answeres are not answred or answered in time. I may be because is a bit offtopic, also can be if "what is the problem with this [cryptic|strange1 whatever code] code", or simpley beacuse nones know what to say.
> In your case, i would say that be more explicit and don't be like "resolve my homework now".
> just general recomendations, and be patient.
> best regards.
> g

Thanks, g.  What happened was that I figured it out.  I was missing a \ in the first of the last 4 \d\d\d\d.  So, I figured it out by making changes to the Regular Expression code.  so, I felt ashamed and said never mind. :)  I am patient.  Do a search on jicman and you'll see plenty of posts. :-)

Thanks,

jic