Substituting letters for numbers

2013-01-02 Thread Hamann, T.D.
Hello, Given a string: i994 where I want to replace the 'i' by a '1' the following regex succesfully replaces the letter by a number: s/(i)(\d\d\d)/1$2/; However, given a string: i99o where I want to replace the 'i' by a '1' and the 'o' by a '0' (zero), the following regex fails: s/(i)(\d

RE: Substituting letters for numbers

2013-01-06 Thread Hamann, T.D.
to change vowels into numbers ;). Thomas -Original Message- From: John W. Krahn [mailto:jwkr...@shaw.ca] Sent: Thursday, January 03, 2013 9:19 AM To: Perl Beginners Subject: Re: Substituting letters for numbers Hamann, T.D. wrote: > Hello, Hello, > Given a string: > > i9

Matching Greek letters in UTF-8 file

2011-09-29 Thread Hamann, T.D. (Thomas)
Hi, I need to write a regex that matches any single Greek letter followed by a hyphen in a UTF-8 text file that is otherwise in English. How can I match the Greek alphabet (lower and upper case)? Thanks, Thomas -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

RE: Matching Greek letters in UTF-8 file

2011-10-10 Thread Hamann, T.D. (Thomas)
Many thanks for the replies. Reading the documentation, it looks like it's a bit more complicated than I had hoped. On the other hand, I realized that for my purpose (removing unwanted hyphens from an OCR'ed document), I don't actually need to match the greek letters, because they occur in two

How to put an AND in a regex?

2011-10-13 Thread Hamann, T.D. (Thomas)
Hi, I am trying to write a regex that should only match when certain patterns are not present, e.g. when a line does not start with either a digit or ALL-CAPS text. I figured I could use negative look-aheads for this. I can write it as: if (/^(?![[:upper:]][[:upper:]])/) { if (/^(?!\d)/)

RE: How to put an AND in a regex?

2011-10-13 Thread Hamann, T.D. (Thomas)
. To use two of them in AND combination, just... use two of them. ) /^(?![[:upper:]][[:upper:]])(?!\d)/ And it gets even better: you may mix any number of look-aheads in a single regex this way. ) -- iD 2011/10/13 Hamann, T.D. (Thomas) > > Hi, > > I am trying to write a regex that

Bizarre problem: Known good script (in 2011) fails to work in 2012

2012-01-04 Thread Hamann, T.D. (Thomas)
Hi, I am having a rather unusual problem with a script that I wrote last year to clean unwanted contents out of UTF-8 encoded text files. It worked fine in the past, but when I try to run it now I get an error message and somehow all newlines are removed from the resulting file. Nothing was cha

RE: Bizarre problem: Known good script (in 2011) fails to work in 2012

2012-01-04 Thread Hamann, T.D. (Thomas)
stion: How much code will this change break? Thomas Van: Hamann, T.D. (Thomas) [ham...@nhn.leidenuniv.nl] Verzonden: woensdag 4 januari 2012 12:27 Aan: beginners@perl.org Onderwerp: Bizarre problem: Known good script (in 2011) fails to work in 2012 Hi,

Some UTF-8-related questions

2012-01-11 Thread Hamann, T.D. (Thomas)
Hi, Thanks for the answers on my last question. I have since then dug a bit further in the UTF-8-related error message I got, and after some reading have a few questions with regards to UTF-8 handling in perl: (Please bear in mind that I am not an IT guy) 1a) My use statements are the followin

RE: Some UTF-8-related questions

2012-01-11 Thread Hamann, T.D. (Thomas)
>>Hi, >>Thanks for the answers on my last question. I have since then dug a bit >>further in the UTF-8-related error >>message I got, and after some reading >>have a few questions with regards to UTF-8 handling in perl: >>(Please bear in mind that I am not an IT guy) > Worry not -- Basically n