LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-07-2009, 04:31 PM   #1
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
what does this regular expression do?


what does this do? :
Code:
[U|LI]N[U|I]X

Last edited by smeezekitty; 10-07-2009 at 04:35 PM.
 
Old 10-07-2009, 04:52 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Well....

It depends on how it is used---right? What is it supposed to do?
 
Old 10-07-2009, 04:54 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
i really dont know
i found it when i digging thru my harddrive
 
Old 10-07-2009, 05:04 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What does this mean?:
[U|LI]

and how is it different from?:
[ULI]
 
Old 10-07-2009, 05:20 PM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Isn't | the operator that matches either argument?

[LI|U]N - would match LIN or UN
[I|U]X - IX or UX

If I'm not mistaken, this search pattern would match either LINUX or UNIX
 
Old 10-07-2009, 05:24 PM   #6
gzunk
Member
 
Registered: Sep 2006
Posts: 89

Rep: Reputation: 20
And LINIX and UNUX
 
Old 10-07-2009, 05:27 PM   #7
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
If I'm not mistaken, this search pattern would match either LINUX or UNIX
.. and LINIX or UNUX surely ?
 
Old 10-07-2009, 05:27 PM   #8
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
thank you
its anoying to come by somthing but nnot know what it does
 
Old 10-07-2009, 05:38 PM   #9
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Originally Posted by gzunk View Post
And LINIX and UNUX
LOL
 
Old 10-07-2009, 06:02 PM   #10
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Actually, it's even worse than that. Pixellany was right.

Code:
[U|LI]N

It would match any word that contains the capital letter U or L or I followed by N. The same goes for the second part of the pattern.
For example, it would match:
ADFAEDUNFAFAFDDIX, etc.
 
Old 10-07-2009, 06:12 PM   #11
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Code:
bash-3.1$ ls | grep -E '[LI|U]N[U|I]X'
ADDFUNUX
INIX
LINIX
LINUX
UNIX
UNUX
UNUXFOD
bash-3.1$ ls | grep -E '(LI|U)N(U|I)X'
ADDFUNUX
LINIX
LINUX
UNIX
UNUX
UNUXFOD
bash-3.1$ ls | grep -E '^(LI|U)N(U|I)X$'
LINIX
LINUX
UNIX
UNUX
bash-3.1$ ls | grep -E '^(LINU|UNI)X$'
LINUX
UNIX
 
  


Reply



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
Help with regular expression Feyd-Rautha Programming 8 04-21-2008 11:18 AM
Do we have regular expression in C++ ? indian Programming 4 03-06-2006 09:54 AM
Need help with Regular Expression subaruwrx Linux - Newbie 6 09-04-2004 07:48 PM
Regular Expression slizadel Programming 4 07-28-2003 05:16 AM
regular expression gumby Programming 3 07-15-2003 12:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:29 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration