Newbie to regular expressions

Tool for Search and Replace across multiple files.
Post Reply
User avatar
Randy

Newbie to regular expressions

Post by Randy »

I just stumbled on your tool and it looks like exactly what I'm looking for but I'm a complete beginner to regular expressions.

Is there a way/what is the way to find a word and randomly replace it with one of a select group of words?

i.e find the word "dog" and randomly replace it with "canine" "big dog" or "little dog".

If that's possible, how would I fine tune it even more to only pick a certain number of occurences of the word "dog" (the first three, the last 3...etc.?

I'm thinking this is possible but I just have no idea how to write the expression. Thanks for all your help!
User avatar
DV

Post by DV »

Hi
As far as I know there is no way to use randomization within regular expressions - it would have to be built into textcrawler and currently it doesn't have this kind of functionality.

http://www.regular-expressions.info is a good site for getting started with reg-exes though.
User avatar
Anonymous

Post by Anonymous »

Thanks for the response...not a big deal. One more quick question if you don't mind though.

Is there a way to insert text after a specific line or at the end of a specific line? My first line of the document is always the title and I want to insert "Written By:xxxx" either at the end of that first line or on the second line.

Sorry if I'm living in a fantasy world with my request but figured it couldn't hurt to ask. Thanks again!
User avatar
DV

Post by DV »

Sorry, this one stumped me. The ^ and $ anchors can match the start and end of line, but you'll need a specific bit of text to help it locate where you want to insert the new text.
User avatar
Dieter

Post by Dieter »

I am just playing with your tool. But so far I have not worked out how to use regular expressions. Somehow it does not work. Placing the code <a[^>]*> in the RegEx Tester it shows all elements found in the relevant file. Putting the same code in the FIND line of the Textcrawler it says "No matches found" :-((
User avatar
DV

Post by DV »

That should work - have you ticked the 'Use Regular Expressions' box to the right?
User avatar
Dieter

Post by Dieter »

Thanks for the immediate response! Problem is that I did not see it - better I still do not see that menu. The reason is - it is totally black on my desktop!

That affects the whole field on the right side. And there is another black zone in the center, but one can read the text at least: saying "In marked files only"

Just by testing the fields I found the right one - and it works! But you should consider improving these areas!
User avatar
DC

Post by DC »

This Happens because of a buggy interaction with the Textcrawler window and your custom windows desktop theme.
Hopefully these issues will be fixed in version 1.1 (though not in the current beta)
Post Reply