Re: Substitution problem

2009-07-23 Thread Chris Wagner
Hi. I'm not totally sure what ur asking but it seems that u want to do variable substitution in an XML file. If the variable names are already in the text u need an eval. $text = eval "\"$xmlfile\""; That will replace $1 with whatever it's current value is.

Substitution problem

2009-07-15 Thread Kprasad
Here is the Perl code which I'm using for substitution in xml file UIIE_A_123456.xml. I'm getting search string and replacement string for substitution from another file (cleanup.txt) But after substitution, variable of replaced string doesn't interpolated as defined in &#

Re: Changing the substitution charactor in Encoding::encode

2006-01-23 Thread Gisle Aas
Foo Ji-Haw <[EMAIL PROTECTED]> writes: > I'm trying to 'water down' a utf8-encoded to latin-1. Using > Encode::encode does the trick, and it replaces character that do not > fit into latin-1 with a subtitution character (as per the > documentation) > > Can anyone tell me how I can change this cha

Changing the substitution charactor in Encoding::encode

2006-01-23 Thread Foo Ji-Haw
Hi all, I'm trying to 'water down' a utf8-encoded to latin-1. Using Encode::encode does the trick, and it replaces character that do not fit into latin-1 with a subtitution character (as per the documentation) Can anyone tell me how I can change this character to something else, like a ' '?

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Andy_Bach
Not sure I'm getting it completely, but using match in a while loop w/ the /g modifier lets you process a string one match at a time: my $string = "Lots of words to be read one at a time.\nthough more than one line"; while ( $string =~ /(\w+)/g ) { print "Found: $1\n"; print "Proceessing ..

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-10 Thread Veli-Pekka Tätilä
Joe Discenza wrote: "Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58 replacement is so complex that it cannot be expressed as a straight substitution. So I would have to find a piece of text, process it in a separate function, and replace the matched text with the newly computed

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Veli-Pekka Tätilä
Kenneth McNamara wrote: You're implying that the music macro language is pos() sensitive. That is a pretty severe problem in itself. Hmm, I'm not totally sure if it is. But true certain modifiers apply until the next note, such as one or more periods. My MML experience is actually from trying t

RE: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-10 Thread Joe Discenza
Title: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString "Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58: Yet another newbie question about regular expressions:: I'd like to find and replace bits of text as usual. However, rather than: replace all

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Kenneth McNamara
and replace bits of text as usual. However, rather than replace all occurrences in one quick swoop using the s- operator and the g-flag, the replacement is so complex that it cannot be expressed as a straight substitution. So I would have to find a piece of text, process it in a separate fu

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-09 Thread Chris Wagner
So what ur saying is that u want to do a lot of substitutions in one pass. U could always have one s///g for each thing u want substituted and run it n times. Can u post some actual strings that u want to parse and the substitutions? Then we can figure it out. At 10:58 PM 10/9/05 +0300, =?iso-88

Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-09 Thread Veli-Pekka Tätilä
aight substitution. So I would have to find a piece of text, process it in a separate function, and replace the matched text with the newly computed text. This goes on for n interesting matches in the input. Can I do this kind of thing in a simple loop, processing all matches one by one? My understandi

Re: Global substitution

2003-05-31 Thread Carl Jolley
On Fri, 30 May 2003, Nut Cracker wrote: > open(MF, "MyFile.txt"); > while(defined($line=)){ > if($line =~ /\/ig){ > $line =~ s/\/\r/; > } > } > > > it might be ugly, but it should work. > > NuTs > It's unnecessarily ugly. There's no need to esca

Re: Global substitution

2003-05-31 Thread Carl Jolley
On Fri, 30 May 2003, Charlie Schloemer wrote: > - Original Message - > From: "Ricci, Mark" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, May 30, 2003 11:04 AM > Subject: Global substitution > > > > Hello All, > > >

Re: Global substitution

2003-05-31 Thread Carl Jolley
On Fri, 30 May 2003, Ricci, Mark wrote: > Hello All, > > I have a file that has characters instead of carriage returns. > I'm having a hard time coming up with an automated search and replace > script. > > Any ideas would be appreciated... > How about $data=~s//\n/gi; [EMAIL PR

Re: Global substitution

2003-05-31 Thread Nut Cracker
MAIL PROTECTED]> Sent: Friday, May 30, 2003 11:04 AM Subject: Global substitution > Hello All, > > I have a file that has characters instead of carriage returns. > I'm having a hard time coming up with an automated search and replace > script. > > Any ideas would be

Re: Substitution

2002-11-26 Thread Lee Goddard
Er, what were you trying to do again? Why won't { my @bits = split":",$in; } be good enough to get the bits, and the rewriting as {print join":",@bits} ? Sorry, little history in my box lee Lee Goddard, BA(Hons), MSc(Sussex) http://www.LeeGoddard.com/ since 1997. Direcotr: Little Bits Ltd

Re: Substitution

2002-11-26 Thread Erich C. Beyrent
> Either quote the meta characters in the search string by enclosing it > in \Q \E sequences or quote each meta separtately by preceeding > it with a \ character, e.g. > > s!\Q$search\E!$replace!; > > or > > @search=split(//,$search); > foreach $char (@search) { > $char="\\$char" if $char=~/\W

Re: Substitution

2002-11-25 Thread Carl Jolley
> > However, I cannot get the substitution to work correctly, I assume, because > of the metacharacters in the string. A typical original string and > replacement would be: > > $search = "../pdf/sax_quartet/BMP0016.pdf:BMP0016.pdf:No baile mas (Dance No > More):Cervante

RE: substitution regular expression

2002-09-10 Thread T&C Winquist
That worked perfectlythanks! -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 1:42 AM To: T&C Winquist Cc: [EMAIL PROTECTED] Subject: Re: substitution regular expression T&C Winquist wrote: > It seems like every

Re: Regex for comma substitution

2001-12-21 Thread John Deurbrouck
Dirk Bremer wrote: > I am looking for a regex to be used for comma substitution for numbers, i.e. the regex would transform: > > 999 = 999 > = 9,999 > 9 = 99,999 > 99 = 999,999 > 999 = 9,999,999, etc. > > I tried s/(\d

Re: Regex for comma substitution

2001-12-21 Thread $Bill Luebkert
Dirk Bremer wrote: > I am looking for a regex to be used for comma substitution for numbers, i.e. the >regex would transform: > > 999 = 999 > = 9,999 > 9 = 99,999 > 99 = 999,999 > 999 = 9,999,999, etc. > > I tried s/(\d{3})/

RE: Regex for comma substitution

2001-12-21 Thread Wagner-David
TED]] Sent: Friday, December 21, 2001 13:18 To: perl-win32-users Subject: Regex for comma substitution I am looking for a regex to be used for comma substitution for numbers, i.e. the regex would transform: 999 = 999 = 9,999 9 = 99,999 99 = 999,999 999 = 9,999,

Regex for comma substitution

2001-12-21 Thread Dirk Bremer
I am looking for a regex to be used for comma substitution for numbers, i.e. the regex would transform: 999 = 999 = 9,999 9 = 99,999 99 = 999,999 999 = 9,999,999, etc. I tried s/(\d{3})/,$1/g, but for certain numbers it leaves a leading comma, i.e. 99

Re: Regex (and substitution) help

2001-06-18 Thread Brian Gibson
Pleic <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 18, 2001 6:49 PM Subject: Regex (and substitution) help > Hi Perlers, > > I need some help with a regex I can't figure out. > > In short, I need to enclose all occurences of certain "label"

Re: Regex (and substitution) help

2001-06-18 Thread Andy Jennings
D]> Sent: Monday, June 18, 2001 5:49 PM Subject: Regex (and substitution) help > Hi Perlers, > > I need some help with a regex I can't figure out. > > In short, I need to enclose all occurences of certain "label" > strings in a text file into '^' m

Re: Regex (and substitution) help

2001-06-18 Thread $Bill Luebkert
Denis Pleic wrote: > > Hi Perlers, > > I need some help with a regex I can't figure out. > > In short, I need to enclose all occurences of certain "label" > strings in a text file into '^' marks. > > I.e., for example: > > "See SAY_PLEASE_TXT and SAY_HELLO_TXT." > > Those string codes *alway

Regex (and substitution) help

2001-06-18 Thread Denis Pleic
Hi Perlers, I need some help with a regex I can't figure out. In short, I need to enclose all occurences of certain "label" strings in a text file into '^' marks. I.e., for example: "See SAY_PLEASE_TXT and SAY_HELLO_TXT." Those string codes *always* come in all caps, and with *at least* one

RE: substitution on a file

2001-05-03 Thread Peter Eisengrein
while (<>) { $_ =~ s/\s$oldWord\s/\s$newWord\s/g; print; } -Original Message- From: Rex Posadas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 03, 2001 12:42 PM To: [EMAIL PROTECTED] Subject: substitution on a file Hi, I'm trying to make substitutions in

Re: substitution on a file

2001-05-03 Thread Steven Wadding
* End of Code *** > >This code replaces any occurance of "Orange" so the word "MyOrange" will >be changed to "MyApple". I would like to change this so that "Orange" is >the only one that is replaced by the string "App

Re: substitution on a file

2001-05-03 Thread Andy Jennings
Add a check for a word boundary to the start and finish of the old word $_ =~ s/\b$oldWord\b/$newWord/g hth Andy - Original Message - From: "Rex Posadas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 03, 2001 11:42 AM Subject: substitution on

RE: substitution on a file

2001-05-03 Thread Mike Prozinski
Mobile => (734) 216-6875 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rex Posadas Sent: Thursday, May 03, 2001 12:42 PM To: [EMAIL PROTECTED] Subject: substitution on a file Hi, I'm trying to make substitutions in a file. My substitution

Re: substitution on a file

2001-05-03 Thread Carl Jolley
On Thu, 3 May 2001, Rex Posadas wrote: > Hi, > > I'm trying to make substitutions in a file. My substitution should only > take affect on exact matches only. below is my code: > > > Start of Code *** > $oldWord = "Orange"; > $n

substitution on a file

2001-05-03 Thread Rex Posadas
Hi, I'm trying to make substitutions in a file. My substitution should only take affect on exact matches only. below is my code: Start of Code *** $oldWord = "Orange"; $newWord = "Apple"; $^I=".bk"; while (<>) { $