l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
July 21: Defensive computing: Information security for individuals
Next Installfest:
TBD
Latest News:
Jul. 4: July, August and September: Security, Photography and Programming for Kids
Page last updated:
2001 Dec 30 17:06

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] Regex question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Regex question


  • Subject: [vox-tech] Regex question
  • From: "Jay Strauss" <jjstrauss@yahMAPSoo.com>
  • Date: Tue, 05 Jun 2001 04:31:23 -0700
  • References: 20010604223422.A29790@houseag.com

Howdy,

I'm trying to do some text mangling in perl, I have some SQL DDL and in this
DDL I'm doing searches and replaces.  the source data looks like (at least
the important bits):

TABLESPACE "SOMENAME"
INITIAL 555053
NEXT 11111
TABLE "TABLE NAME"

ie I have a keyword followed by N spaces/whitespace then a sting or numbers,
optionally enclosed by "", the whole thing is terminated by whitespace or
newline.

What I want to do is find expressions like described.  Save save the
beginning part and
replace the ending part.

s/\b(\w+)\b("?(\d+)"?\b/$1,$replacement_hash{$2}/g;

What I'm attempting is:
starting on a word boundary, find 1 or more word characters (and save them),
ending on a
word boundary, then find any digits/alphas surrounded optionally by " (save
them) and ending on a word boundary.  Then replace the first saved part with
the first saved part, replace the second saved part with a replacement hash
value.

But this is wrong

any help???

P.s.  Linus gave an interview on NPR
http://www.npr.org/ramfiles/fa/20010604.fa.01.ram

Jay



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!