RegEx behaviour

A swapping-ground for Regular Expression syntax

RegEx behaviour

Postby CuiZinieR » Mon Dec 03, 2007 12:57 am

Hello everybody !

It's my first message here. I would like to congratulate the creator of Bulk Rename Utility because it's a very useful software.

I post here because I don't understand the behaviour of the RegEX function in the software.

For example, I want to modify a filename like this: The Twilight Zone - S1E01 Une vie tranquille.
In the RegEx field of the software, I type The in Match TextBox.
Then, I type aaa in Replace TextBox.

And the result for the filename is: aaa.
I don't understand this because I think the result must be aaa Twilight Zone - S1E01 Une vie tranquille.

Can you help me please ?
CuiZinieR
 
Posts: 1
Joined: Fri Nov 23, 2007 7:38 am
Location: Montreal (Canada)

Postby Admin » Mon Dec 03, 2007 12:02 pm

Hi,

For the problem you have you would be better to use a straightforward search and replace, rather than regexp. With regexp you'd haveto use semething like

(the)(.*)
aaa\2


Jim
Admin
Site Admin
 
Posts: 2572
Joined: Tue Mar 08, 2005 8:39 pm

RegEx behaviour

Postby Karapaz » Tue Jun 09, 2009 4:13 pm

Hello everybody,

Id like to know how is it I should write a regex in unix to match a string not followed by another string anywhere in the line.

To be more specific, I want to find lines where drop table is found, but not followed anywhere in the line by the character &.

For example,

I want to grep the line drop table dbo.TAB_PUV_CR_0000692 in a file but not the line drop table dbo.&1

Thks a lot
Karapaz
 
Posts: 6
Joined: Mon May 18, 2009 11:41 pm
Location: USA

Re: RegEx behaviour

Postby shhac » Tue Jun 30, 2009 11:04 am

Karapaz wrote:Hello everybody,
Id like to know how is it I should write a regex in unix to match a string not followed by another string anywhere in the line.
To be more specific, I want to find lines where drop table is found, but not followed anywhere in the line by the character &.
For example,
I want to grep the line drop table dbo.TAB_PUV_CR_0000692 in a file but not the line drop table dbo.&1
Thks a lot

Code: Select all
dbo\.[^&]+

not sure if you need to slash the & but it should be easy enough to test.
shhac
 
Posts: 15
Joined: Tue Sep 11, 2007 10:47 pm


Return to Regular Expressions


cron