LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-27-2006, 01:08 PM   #1
lluciano
LQ Newbie
 
Registered: Feb 2004
Distribution: FC4
Posts: 19

Rep: Reputation: 0
perl pattern match question


We have a pattern match command in one of our scripts that we are having some difficulty translating. Can anyone tell us exactly what this does?

$cmdrslt =~ m/\e\[0G([^\e]+)\e\[10G([^\e]+)\e\[38G([^\e]+)\e\[66G([^\e]+)\e\[71G([^\e]+)\e\[75G([^\e]+)\e\[66G([^\e]+)\e\[75G([^\e]+)/mg
 
Old 02-27-2006, 04:02 PM   #2
DanTaylor
Member
 
Registered: Jan 2006
Distribution: Debian Sarge
Posts: 265

Rep: Reputation: 30
Wow - Can't tell you right off but I will work on it.

By the way - what crazy programmer wrote this code without a comment????
 
Old 02-27-2006, 05:36 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
It looks like it's trying to match an ANSI escape sequence - but it hurts my eyes to look at it for more than a couple of seconds.
Code:
\e is an escape
Followed by '[0G'
Followed by 1 or more characters that aren't an escape
Followed by an escape
Followed by '[10G'
Followed by 1 or more characters that aren't an escape
Followed by an escape
etc.
Could it be matching the escape codes from a screen output?

Last edited by gilead; 02-27-2006 at 05:47 PM.
 
Old 02-27-2006, 11:25 PM   #4
DanTaylor
Member
 
Registered: Jan 2006
Distribution: Debian Sarge
Posts: 265

Rep: Reputation: 30
what type of program was this in??
 
Old 02-28-2006, 05:59 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
my god it's awful!
who writes such rubbish?

gilead looks right to me.
is it screen-scraping?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
svcadm: Pattern 'apache' doesn't match any instances xpucto Solaris / OpenSolaris 8 02-19-2006 07:30 AM
Perl Pattern Matching Question pete1234 Programming 2 08-27-2005 10:26 AM
Procmail: match pattern then pass to shell script essdeeay Linux - Software 1 11-08-2004 02:19 PM
pattern matchin with perl gene_gEnie Programming 6 09-29-2001 11:40 PM


All times are GMT -5. The time now is 03:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration