Jump to content

Regular Expressions


Recommended Posts

I've been reading how-tos on regular expressions but haven't figured this out... hasn't clicked. I want to build a regular expression that does the following..

 

1. case-insensitive

2. Finds the following pattern

 

para*()

 

where * is anything, characters or spaces, tabs whatever..

 

Any propeller heads out there?

 

Additionally, an extra would be to take the same but the match would have to be any match

 

parameters()

parameter()

paramete()

paramet()

parame()

param()

para()

 

I'm using a company search engine so it has to be a regex, so it can't be linux specific..

 

Help?

Link to comment
Share on other sites

just wait for the resident bash nut to appear and you will get your fill of a thousand ways to do your search. :D

 

kidding aside, wont "para.*()" do? i dont know about the sensitivity issue though. i havent gone that deep yet.

 

ciao!

Link to comment
Share on other sites

Your first example worked, however, it brought up various lines such as

 

a = "parameter: " + somefunction()

 

Maybe regular expressions can't do it? Wish I had more time to figure this but if anyone has any more input please add here. Most coders I know are familiar with regex but don't really know it in/out..

Link to comment
Share on other sites

You may have to do

 

para.*\(\)

 

I dunno about case-insensitivity, though...maybe

 

/para.*\(\)/i

 

?

doesnt \(\) have a special meaning in regular expressions? aru taught me that those symbols keeps the matched characters inside. its so useful that i have created a wiki for it. B)

 

ciao!

Edited by ramfree17
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...