Re: Special Character in String

  • Follow


Thanks everyone for your Inputs , that really helps.
will let know If I see any Issue.

- Swamy.
On Mon, Nov 16, 2009 at 4:52 PM, Tom Abernathy <tom.abernathy@gmail.com>wro=
te:

> I think you just want to use the INDEXC function.
> IF INDEXC(trim(STRING),' /-') > 0 THEN DO;
>  * Bad string ;
> ...
> END;
>
>
> On Nov 16, 4:28 pm, xlr82sas <xlr82...@aol.com> wrote:
> > On Nov 16, 10:10 am, tobyd...@HOTMAIL.COM (toby dunn) wrote:
> >
> >
> >
> >
> >
> > > Not totally sure of all your rules but from what I was able to glean
> from your post here is a possible solution:
> >
> > > Data Have ;
> > > Length Text $ 7 ;
> > > Text =3D "A12345" ;
> > > Output ;
> > > Text =3D "A 1234" ;
> > > Output ;
> > > Text =3D " A12345" ;
> > > Output ;
> > > Text =3D "B-5642" ;
> > > Output ;
> > > Text =3D "C/9876" ;
> > > Output ;
> > > Text =3D "C122334" ;
> > > Output ;
> > > ;
> > > Run ;
> >
> > > Data Need ;
> > > Set Have ;
> > > Valid =3D PRXMatch( '/^[a-z][1-9]*\s?$/io'  , Text ) ;
> > > Put Text=3D Valid=3D ;
> > > Run ;
> >
> > > Toby Dunn
> >
> > > "Don't bail. The best gold is at the bottom of barrels of crap."
> >
> > > Randy Pausch
> >
> > > "Be prepared. Luck is where preparation meets opportunity."
> >
> > > Randy Pausch
> >
> > > ----------------------------------------
> >
> > > > Date: Mon, 16 Nov 2009 12:59:18 -0500
> > > > From: sassw...@GMAIL.COM
> > > > Subject: Special Character in String
> > > > To: SA...@LISTSERV.UGA.EDU
> >
> > > > Hello,
> > > > I need to check a string for the following : a) White Space b)
> Slashes =91/=92
> > > > c) Dashes =91-=91 d) Left aligned
> >
> > > > If any of the above exist , then I need to report that particular
> string
> > > > as =91Invalid=92 , can someone please help me in the coding part
> > > > e-g , If the string is =91A1234567TEST=92 - valid ,
> > > > If the string is A 12345 OR
> > > > B-13123
> > > > OR C/123129
> > > > OR if the string character starts from the 2nd position with a whit=
e
> space
> > > > in the beginning then those are Invalid rows
> >
> > > > Thanks,
> > > > swamy
> >
> > > _________________________________________________________________
> > > Bing brings you maps, menus, and reviews organized in one place.
> http://www.bing.com/search?q=3Drestaurants&form=3DMFESRP&publ=3DWLHMTAG&c=
re...Hidequoted text -
> >
> > > - Show quoted text -
> >
> > Toby thanks for showing the o option. I did not know that, it
> > eliminates  the _n_ logic, but only applies to fixed regexes.
> >
> > Another possible solution
> >
> > Data Have ;
> > Length Text $ 13 ;
> > Text =3D "AA12345" ;
> > Output ;
> > Text =3D "A 1234" ;
> > Output ;
> > Text =3D " A12345" ;
> > Output ;
> > Text =3D "B-5642" ;
> > Output ;
> > Text =3D "C/9876" ;
> > Output ;
> > Text =3D "Z1234567TEST" ;
> > Output ;
> > ;
> > Run ;
> >
> > Data Need ;
> > Set Have ;
> > /* what is going on
> >    |  =3D the or operator
> >   ^\s =3D does the string begin with a space
> >    \/ =3D escape the / and does the string have a /
> >    \- =3D escape the - and does the string have a -
> >    \s =3D escape the space. is there an internal space
> >    io =3D ignore case - not needed here.  And do not recompile the
> > regex
> > */
> > Valid =3D not PRXMatch ('/^\s|\/|\-|\s/io',trim(Text));
> > Put Text=3D Valid=3D ;
> > Run ;- Hide quoted text -
> >
> > - Show quoted text -
>
0
Reply sasswamy (42) 11/17/2009 6:01:35 PM


0 Replies
167 Views

(page loaded in 0.034 seconds)


Reply: