[sword-devel] What is wrong with my regexes? Help appreciated

DM Smith dmsmith at crosswire.org
Mon Oct 26 10:20:21 MST 2009

On 10/26/2009 11:22 AM, Peter von Kaehne wrote:
> I am working on a lengthy Farsi text with the help of a perl script 
> which has slowly grown into a great tool.
> But some patterns refuse to budge and I am totally clueless what to do.
> Original text
> متی
> starting at position 1 and ending the line with a return.
> My regex
> s/^متی$/<title>$&<\/title>/;
This looks right to me. I verified that it works as I expect on this 
email, with:
perl -p -e 's/^متی$/<title>$&<\/title>/;' < email.txt

This should match the against the contents of $_, with ^ and $ anchoring 
the beginning and end of content of $_.
Perhaps, $_ contains something that you don't expect (like one word at a 

> finds all lines with the word at whatever in sentence position - 
> instead of picking only lines with the single word متی on the line.
> What am I doing wrong?
> Thanks
> Peter
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

More information about the sword-devel mailing list