Page 1 of 1
Newbie to regular expressions
Posted: Tue May 20, 2008 6:56 pm
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!
Posted: Wed May 21, 2008 10:37 am
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.
Posted: Wed May 21, 2008 5:33 pm
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!
Posted: Wed Jun 25, 2008 9:25 am
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.
Posted: Wed Jul 16, 2008 5:36 pm
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"

(
Posted: Wed Jul 16, 2008 7:29 pm
by DV
That should work - have you ticked the 'Use Regular Expressions' box to the right?
Posted: Wed Jul 16, 2008 7:51 pm
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!
Posted: Tue Jul 29, 2008 1:45 pm
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)