Re: How to test for existence of file with non-ascii characters

2018-12-26 Thread Uri Guttman
On 12/26/18 7:31 AM, Mike Martin wrote: Any ideas how to test for the existance of a file, when the file name contains extended ascii characters For example if the file contains emdash (U-2014) file -e always returns false -e should not be looking at the filename directly. it checks if

Re: How to test for existence of file with non-ascii characters

2018-12-26 Thread Jesús Ruiz
w to test for the existance of a file, when the file name > contains extended ascii characters > > For example if the file contains emdash (U-2014) file -e always returns > false > > thanks > > Mike -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

How to test for existence of file with non-ascii characters

2018-12-26 Thread Mike Martin
Any ideas how to test for the existance of a file, when the file name contains extended ascii characters For example if the file contains emdash (U-2014) file -e always returns false thanks Mike

Re: regex matches Chinese characters

2018-07-26 Thread Shlomi Fish
Hi Lauren, On Fri, 27 Jul 2018 11:28:42 +0800 "Lauren C." wrote: > greetings, > > I was doing the log statistics stuff using perl. > There are chinese characters in log items. > I tried with regex to match them, but got no luck. > > $ perl -mstrict -le '

Re: regex matches Chinese characters

2018-07-26 Thread Lauren C.
oops that's perfect. thanks Shlomi. On 2018/7/27 星期五 PM 1:26, Shlomi Fish wrote: Hi Lauren, On Fri, 27 Jul 2018 11:28:42 +0800 "Lauren C." wrote: greetings, I was doing the log statistics stuff using perl. There are chinese characters in log items. I tried with regex to matc

regex matches Chinese characters

2018-07-26 Thread Lauren C.
greetings, I was doing the log statistics stuff using perl. There are chinese characters in log items. I tried with regex to match them, but got no luck. $ perl -mstrict -le 'my $char="汉语"; print "it is chinese" if $char =~ /\p{Han}+/' $ perl -mstrict -mutf8 -l

Re: Regex to match "bad" characters in a parameter

2016-01-27 Thread lee
"Chris Charley" writes: > You could do that in 1 line - See the following small program. > (The line using a 'grep' solution is commented out. It would work as well). > > > #!/usr/bin/perl > use strict; > use warnings; > > while (my $id = ) { >chomp $id; >#if (grep /itemid=.*?[^\w-]/, spl

Re: Regex to match "bad" characters in a parameter

2016-01-26 Thread SSC_perl
On Jan 26, 2016, at 11:22 AM, Chris Charley wrote: > > You could do that in 1 line - See the following small program. Thanks, Chris. That'll do the trick. And the grep alternative is interesting, too. I hadn't thought of that. Regards, Frank -- To unsubscribe, e-mail: beginners-unsub

Re: Regex to match "bad" characters in a parameter

2016-01-26 Thread Chris Charley
"SSC_perl" wrote in message news:ef7499af-b4a5-4b07-8c69-3192ef782...@surfshopcart.com... On Jan 25, 2016, at 4:59 PM, Shawn H Corey wrote: Use the negative match operator !~ if( $QUERY_STRING !~ m{ itemid = [-0-9A-Za-z_]+? (?: \& | \z ) }msx ){ print "bad: $QUERY_STRING\n"; } Tha

Re: Regex to match "bad" characters in a parameter

2016-01-26 Thread SSC_perl
On Jan 25, 2016, at 4:59 PM, Shawn H Corey wrote: > > Use the negative match operator !~ > > if( $QUERY_STRING !~ m{ itemid = [-0-9A-Za-z_]+? (?: \& | \z ) }msx ){ >print "bad: $QUERY_STRING\n"; > } Thanks for that, Shawn. It works perfectly except for one criteria that I inadver

Re: Regex to match "bad" characters in a parameter

2016-01-25 Thread Shawn H Corey
On Mon, 25 Jan 2016 16:16:40 -0800 SSC_perl wrote: > I'm trying to find a way to trap bad item numbers. I want to > parse the parameter "itemid=" and then everything up to either an "&" > or end-of-string. A good item number will contain only ASCII > letters, numbers, dashes, and undersco

Regex to match "bad" characters in a parameter

2016-01-25 Thread SSC_perl
I'm trying to find a way to trap bad item numbers. I want to parse the parameter "itemid=" and then everything up to either an "&" or end-of-string. A good item number will contain only ASCII letters, numbers, dashes, and underscores and may terminate with a "&" or it may not (see samp

Re: HTML::TokeParser munging characters

2013-12-28 Thread Lars Noodén
On 12/28/2013 05:52 PM, Shawn Wilson wrote: > The parser has done what its supposed to. IDK you can alter the > encoding in it. Maybe you can and that's what you're looking for > (encoding or character set). I'd first try binmode UTF-8 but you'll > probably just end up handling this with a regex.

Re: HTML::TokeParser munging characters

2013-12-28 Thread Shawn Wilson
The parser has done what its supposed to. IDK you can alter the encoding in it. Maybe you can and that's what you're looking for (encoding or character set). I'd first try binmode UTF-8 but you'll probably just end up handling this with a regex. "Lars Noodén" wrote: >If there is a better list

HTML::TokeParser munging characters

2013-12-28 Thread Lars Noodén
If there is a better list for discussing HTML::TokeParser, I can post there. I have a code snippet which successfully extracts a piece of a web page. However, something goes south with the conversion to text. What should come out as the following Temperature 3.2°C Humidity 94%

Re: Filtering Characters

2013-09-04 Thread Rob Dixon
On 04/09/2013 03:58, Michael Rasmussen wrote: On Wed, Sep 04, 2013 at 02:31:30AM +0100, Rob Dixon wrote: John's solution: next if /[^[:lower:]_\d\-. ]/; Doesn't work in this test environment: michael@bivy:~$ cat tpl && ./tpl #!/usr/bin/perl use strict; use warnings;

Re: Filtering Characters

2013-09-03 Thread Jim Gibson
>>> >>> >>> It skips to the next item in the while loop of the string begins with >>> # and works fine. I would also like to skip to the next item in the >>> loop if the string contains anything other then lowercase, >>> underscores, numbers,

Re: Filtering Characters

2013-09-03 Thread Michael Rasmussen
ing begins with > ># and works fine. I would also like to skip to the next item in the > >loop if the string contains anything other then lowercase, > >underscores, numbers, dashes, periods, and spaces. I do not want > >uppercase characters and any sort of other special ch

Re: Filtering Characters

2013-09-03 Thread Rob Dixon
ntains anything other then lowercase, >underscores, numbers, dashes, periods, and spaces. I do not want >uppercase characters and any sort of other special characters. How >would I do that? The solution from John Krahn is superior by far, and there is no need for any other suggestions

Re: Filtering Characters

2013-09-03 Thread John Delacour
, and spaces. I do not want > uppercase characters and any sort of other special characters. How > would I do that? Try this: #!/usr/bin/perl use strict; while () { #chomp; next if /^#/; next unless /^[a-z0-9 -\._]+$/; print; } __DATA__ good bAd go-od. #bad JD -- To u

Re: Filtering Characters

2013-09-03 Thread Jing Yu
; # and works fine. I would also like to skip to the next item in the > loop if the string contains anything other then lowercase, > underscores, numbers, dashes, periods, and spaces. I do not want > uppercase characters and any sort of other special characters. How > would I do that?

Re: Filtering Characters

2013-09-03 Thread John W. Krahn
, underscores, numbers, dashes, periods, and spaces. I do not want uppercase characters and any sort of other special characters. How would I do that? next if /[^[:lower:]_\d\-. ]/; John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of

Re: Filtering Characters

2013-09-03 Thread Nathan Hilterbrand
then lowercase, underscores, numbers, dashes, periods, and spaces. I do not want uppercase characters and any sort of other special characters. How would I do that? I dunno.. maybe: while () { chomp; next if /^#/; next unless /^[a-z0-9_-. ]+$/; # do stuff } I didn&#

Filtering Characters

2013-09-03 Thread Matt
, dashes, periods, and spaces. I do not want uppercase characters and any sort of other special characters. How would I do that? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Handling special characters in peoples names in XML

2013-07-02 Thread Jenda Krynicky
From: Gregory Machin > Thanks Terry for responding. > > The files are very big and contain data I'd prefer not to be out in the > wild. what parts of the file would be helpful , I can provide the lines > with the text and say heard part of the xml ?? > > Thanks > G Yep, that should be enough.

Re: Handling special characters in peoples names in XML

2013-06-25 Thread Charles DeRykus
On Wed, Jun 26, 2013 at 7:45 AM, Peter Gordon wrote: > On Wed, 26 Jun 2013 12:36:01 +1200, Gregory Machin wrote: > > > >Looks like the data already is utf8, but the header of the XML > >specifies otherwise. > >How do you parse the data? Can you give us a short example file? > > > >Jenda > > This

Re: Handling special characters in peoples names in XML

2013-06-25 Thread Peter Gordon
On Wed, 26 Jun 2013 12:36:01 +1200, Gregory Machin wrote: > >Looks like the data already is utf8, but the header of the XML >specifies otherwise. >How do you parse the data? Can you give us a short example file? > >Jenda This is a bit of code I adapt to whichever encoding I require. use open ":enc

Re: Handling special characters in peoples names in XML

2013-06-25 Thread Gregory Machin
gt; From: Gregory Machin > > I'm debugging an application written in Perl that converse data exported > > from the Nessus security scanner in xml format. I have narrowed down the > > bug to an issue with special characters in names that are in the file > such > > a

Re: Handling special characters in peoples names in XML

2013-06-20 Thread Jenda Krynicky
From: Gregory Machin > I'm debugging an application written in Perl that converse data exported > from the Nessus security scanner in xml format. I have narrowed down the > bug to an issue with special characters in names that are in the file such > as Fr~A©d~A©ric and Gr~A©goi

Handling special characters in peoples names in XML

2013-06-19 Thread Gregory Machin
Hi. I'm debugging an application written in Perl that converse data exported from the Nessus security scanner in xml format. I have narrowed down the bug to an issue with special characters in names that are in the file such as Frédéric and Grégoire , thus é are most likely the guilty pa

Re: Script for create a file name with Invalid characters in windows

2012-11-02 Thread Shlomi Fish
Hi Bhanu, On Fri, 2 Nov 2012 18:49:58 +0530 bhanu chaitanya abbaraju wrote: > Hi All, > > Can any one help me, how can we create a file name with invalid characters > ('?','/') in windows. Generally, Windows OS can not allow to create a file > name with inv

Script for create a file name with Invalid characters in windows

2012-11-02 Thread bhanu chaitanya abbaraju
Hi All, Can any one help me, how can we create a file name with invalid characters ('?','/') in windows. Generally, Windows OS can not allow to create a file name with invalid characters like '?,/' . But, I heard that we can able to do with Perl script. If any one

Re: Multiple matching of a group of characters

2012-10-03 Thread Brandon McCaig
On Tue, Oct 02, 2012 at 11:19:51PM +0100, Florian Huber wrote: > The string is: > > >ENSG0112365|ENST0230122|109783797|109787053TGTTTCACAATTCACTACTAAATGTGTACCATTAAATTGAACAGAAAGCTGAGGAATGAACTTCAAGCATTACAAG > > So I'm trying to retrieve'ENSG0112365', 'ENST0230122

Re: Multiple matching of a group of characters

2012-10-03 Thread Florian Huber
Flo Original-Nachricht > Datum: Tue, 2 Oct 2012 19:17:58 -0400 > Von: William Muriithi > An: Florian Huber > CC: beginners@perl.org > Betreff: Re: Multiple matching of a group of characters > Florian, > > > > The string is: > > >

Re: Multiple matching of a group of characters

2012-10-02 Thread William Muriithi
>>> $string =~ /[ACGT]*/; >>> >>> and now it doesn't match anything. Shouldn't it try to match as >>> many times as possible? >> >> It should match at least the once that you saw earlier (assuming >> the same data). >> >>&g

Re: Multiple matching of a group of characters

2012-10-02 Thread Jim Gibson
2' and the > sequence bit, starting with a 'T' and get rid of the junk in between. > > code: > > /#!/usr/bin/perl// > // > //use strict;// > //use warnings;// > // > //my $gene;// > //my @elements = <>;// > // > //foreach $gene (@elemen

Re: Multiple matching of a group of characters

2012-10-02 Thread Florian Huber
it matches 5 letters, but this time from the beginning, i.e.: ACGAC. I'm guessing that the first 'NOTNEEDED' contains a 'G'. That would explain the first match. The second result is nonesense with the data we've seen. :-/ If 'NOTNEEDED' doesn't contain a s

Re: Multiple matching of a group of characters

2012-10-01 Thread Brandon McCaig
east the once that you saw earlier (assuming the same data). > My confusion was complete when I tried > > $string =~ /[ACGT]{5}/; > > now it matches 5 letters, but this time from the beginning, > i.e.: ACGAC. I'm guessing that the first 'NOTNEEDED' contains a

Re: Multiple matching of a group of characters

2012-10-01 Thread Andy Bach
On Mon, Oct 1, 2012 at 5:15 PM, Florian Huber wrote: > > My confusion was complete when I tried > > $string =~ /[ACGT]{5}/; > > now it matches 5 letters, but this time from the beginning, i.e.: ACGAC. >I'm trying to extract a DNA sequence out of a larger string, i.e. the string >is of the follow

Re: Multiple matching of a group of characters

2012-10-01 Thread Jim Gibson
expression /[ACGT]*/ can match anywhere in any string. Therefore, since the regular expression matches at the first letter, the regular expression will declare a match and stop. If you want to match "one or more" characters, then use /[ACGT]+/. > > My confusion was complete when

Multiple matching of a group of characters

2012-10-01 Thread Florian Huber
Dear all, I'm trying to extract a DNA sequence out of a larger string, i.e. the string is of the following structure: $string = "/NOTNEEDED/*ACGACGGGTTCAAGGCAG*/NOTNEEDED/" But when I do $string =~ /[ACGT]/; it matches only the last letter, i.e. "G". Why doesn't it start at the beginning?

Re: insert a . every four characters

2012-03-09 Thread Jim Gibson
At 8:37 PM -0800 3/9/12, Noah wrote: Hi there, I am trying to insert a '.' every four characters. Say I have a $it = '123456789012' and want the result to be '1234.5678.9012' whats one of the smoothest ways to do that? You could adapt the method suggested b

Re: insert a . every four characters

2012-03-09 Thread Owen
> On 3/9/12 8:37 PM, Noah wrote: >> Hi there, >> >> I am trying to insert a '.' every four characters. Say I have a $it >> = >> '123456789012' and want the result to be '1234.5678.9012' >> >> whats one of the smoothest

Re: insert a . every four characters

2012-03-09 Thread Noah
On 3/9/12 8:37 PM, Noah wrote: Hi there, I am trying to insert a '.' every four characters. Say I have a $it = '123456789012' and want the result to be '1234.5678.9012' whats one of the smoothest ways to do that? okay I answered my own question. I am wonderin

insert a . every four characters

2012-03-09 Thread Noah
Hi there, I am trying to insert a '.' every four characters. Say I have a $it = '123456789012' and want the result to be '1234.5678.9012' whats one of the smoothest ways to do that? Cheers, Noah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org F

Re: Appending extra characters to file name

2012-01-06 Thread Alex Ardin
Many good points, chomp resolved the issue but thanks for the information in both posts, very helpful, so many things to learn yet. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Appending extra characters to file name

2012-01-05 Thread John W. Krahn
Alex Ardin wrote: Hi, Hello, I frequently have to review logs that are captured with 'script' using terminal but these logs have many control characters. The intent of the script is the following: 1. Get a listing of all the logs in a directory, storing the list of files i

Re: Appending extra characters to file name

2012-01-05 Thread Igor Dovgiy
b. -- iD 2012/1/5 Alex Ardin > Hi, > I frequently have to review logs that are captured with 'script' using > terminal but these logs have many control characters. > > The intent of the script is the following: > > 1. Get a listing of all the logs in a directory

Appending extra characters to file name

2012-01-05 Thread Alex Ardin
Hi, I frequently have to review logs that are captured with 'script' using terminal but these logs have many control characters. The intent of the script is the following: 1. Get a listing of all the logs in a directory, storing the list of files in an array. 2. For each filename in

Re: Search and replace w/ ignoring arbitrary characters

2011-08-10 Thread Frank Müller
hi, thank you for your solution which works perfect for the data i have given. the trouble is: my data looks a little more complex as I have lots of accented characters so with your code I need to specify each of those characters in the tr/// part. I reckon the other way around would be more

Re: Search and replace w/ ignoring arbitrary characters

2011-08-08 Thread John W. Krahn
Frank Müller wrote: dear all, Hello, i want to make some search and replace within a string where I can define a set of characters, especially parenthesis, brackets etc., which are to be ignored. For example, I have the following string: sdjfh sdf sjkdfh sdkjfh sdjkf f[o]o(bar) hsdkjfh

Search and replace w/ ignoring arbitrary characters

2011-08-08 Thread Frank Müller
dear all, i want to make some search and replace within a string where I can define a set of characters, especially parenthesis, brackets etc., which are to be ignored. For example, I have the following string: sdjfh sdf sjkdfh sdkjfh sdjkf f[o]o(bar) hsdkjfh sdkljfhs sjfh sdkj sdjkfh sdjfh

Re: Characters

2011-08-02 Thread Shawn H Corey
On 11-08-02 01:26 PM, Brandon McCaig wrote: By then I just had to find the official documentation for the feature to satisfy my curiosity. :\ Yes, it's the bane of restful nights and many a dead cat. :) -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of unde

Re: Characters

2011-08-02 Thread Brandon McCaig
On Mon, Aug 1, 2011 at 6:29 PM, Jim Gibson wrote: > Dr. Ruud is demonstrating the little-known but documented feature of Perl > that the explicit empty regex // repeats the last, successful regex within > its scope. Thus, in Dr. Ruud's sample program, the line > >  my @result = $text =~ //g; > > i

Re: Characters

2011-08-02 Thread Rob Dixon
On 01/08/2011 23:29, Jim Gibson wrote: On 8/1/11 Mon Aug 1, 2011 11:20 AM, "Rob Dixon" scribbled: On 01/08/2011 19:00, Dr.Ruud wrote: On 2011-08-01 15:52, Shlomi Fish wrote: To convert a string to characters one can use split based on the empty regex, That should be "a p

Re: Characters

2011-08-01 Thread Emeka
. >> >> Say I have >> $foo = "From Big Brother Africa"; >> I would want to print each of the characters of $foo on its own. >> >> In some languages string type is just array/list of characters. What is it >> in Perl? >> > > Hi Emeka >

Re: Characters

2011-08-01 Thread Emeka
eka wrote: > >> >> In some languages string type is just array/list of characters. What is it >> in Perl? >> >> > There's no string type in Perl, internals notwithstanding. There's scalars, > and a scalar can hold a string - If you care to dig deeper, that

Re: Characters

2011-08-01 Thread Brian Fraser
On Mon, Aug 1, 2011 at 9:14 AM, Emeka wrote: > > In some languages string type is just array/list of characters. What is it > in Perl? > > There's no string type in Perl, internals notwithstanding. There's scalars, and a scalar can hold a string - If you care to dig deep

Re: Characters

2011-08-01 Thread Jim Gibson
On 8/1/11 Mon Aug 1, 2011 11:20 AM, "Rob Dixon" scribbled: > On 01/08/2011 19:00, Dr.Ruud wrote: >> On 2011-08-01 15:52, Shlomi Fish wrote: >> >>> To convert a string to characters one can use split based on the empty >>> regex, >> >&

Re: Characters

2011-08-01 Thread Rob Dixon
On 01/08/2011 19:00, Dr.Ruud wrote: On 2011-08-01 15:52, Shlomi Fish wrote: To convert a string to characters one can use split based on the empty regex, That should be "a pattern matching the empty string". The "empty regex" works differently: perl -wle ' my $

Re: Characters

2011-08-01 Thread Dr.Ruud
On 2011-08-01 15:52, Shlomi Fish wrote: To convert a string to characters one can use split based on the empty regex, That should be "a pattern matching the empty string". The "empty regex" works differently: perl -wle ' my $text = "abcdefghi"; $text

Re: Characters

2011-08-01 Thread Rob Dixon
On 01/08/2011 13:14, Emeka wrote: I would like to know how to access character from string lateral. Say I have $foo = "From Big Brother Africa"; I would want to print each of the characters of $foo on its own. In some languages string type is just array/list of characters. What is

Re: Characters

2011-08-01 Thread Emeka
Shlomi, Yea, that makes sense now. Emeka On Mon, Aug 1, 2011 at 2:52 PM, Shlomi Fish wrote: > On Mon, 1 Aug 2011 13:49:22 +0100 > AKINLEYE wrote: > > > my @characters = split /[\s]/, $foo; > > foreach my $letter(@characters ) > > { > >print $letter

Re: Characters

2011-08-01 Thread Shlomi Fish
On Mon, 1 Aug 2011 13:49:22 +0100 AKINLEYE wrote: > my @characters = split /[\s]/, $foo; > foreach my $letter(@characters ) > { >print $letter ; > > } > > or > > my @characters = split /[\s]/, $foo; > print join("\n" , @characters); > That

Re: Characters

2011-08-01 Thread Emeka
om Big Brother Africa"; >> I would want to print each of the characters of $foo on its own. >> >> In some languages string type is just array/list of characters. What is it >> in Perl? >> > > A string. > > In Perl there are a few ways to do what you wa

Re: Characters

2011-08-01 Thread John W. Krahn
Emeka wrote: Hello All, Hello, I would like to know how to access character from string lateral. Say I have $foo = "From Big Brother Africa"; I would want to print each of the characters of $foo on its own. In some languages string type is just array/list of characters. What is

Re: Characters

2011-08-01 Thread AKINLEYE
my @characters = split /[\s]/, $foo; foreach my $letter(@characters ) { print $letter ; } or my @characters = split /[\s]/, $foo; print join("\n" , @characters); Untested code though. OP Hello All, I would like to know how to access character from string lat

Re: Characters

2011-08-01 Thread Shawn H Corey
On 11-08-01 08:14 AM, Emeka wrote: Hello All, I would like to know how to access character from string lateral. Say I have $foo = "From Big Brother Africa"; I would want to print each of the characters of $foo on its own. In some languages string type is just array/list of charac

Characters

2011-08-01 Thread Emeka
Hello All, I would like to know how to access character from string lateral. Say I have $foo = "From Big Brother Africa"; I would want to print each of the characters of $foo on its own. In some languages string type is just array/list of characters. What is it in Perl? Emeka --

Re: gettting rid of whitespace characters

2011-05-10 Thread John W. Krahn
Irene Zweimueller wrote: Dear list, Hello, I´m relatively new to Perl, so please be patient. Welcome to Perl and the beginners list. I tied to get rid of whitespace characters by the following programme: my $i=" USEFUL "; if ($i =~ /\s/)

Re: gettting rid of whitespace characters

2011-05-10 Thread shawn wilson
On Tue, May 10, 2011 at 1:32 PM, Leo Susanto wrote: > http://en.wikipedia.org/wiki/Trim_%28programming%29 > > $string =~ s/^\s+|\s+$//g ;     # remove both leading and trailing whitespace > 1. don't do that. search on perlmonks and you'll find a long discussion with benchmarks. that takes quite a

Re: gettting rid of whitespace characters

2011-05-10 Thread Leo Susanto
Zweimueller wrote: > Dear list, > > I´m relatively new to Perl, so please be patient. > > I tied to get rid of whitespace characters by the following programme: > > my $i="                USEFUL                   "; > > > if ($i =~ /\s/) > { > $i =~ s/

Re: gettting rid of whitespace characters

2011-05-10 Thread Shawn H Corey
On 11-05-10 01:25 PM, Irene Zweimueller wrote: I tied to get rid of whitespace characters by the following programme: my $i=" USEFUL "; $i =~ s/\s//g; The /g modifier means to repeatly look for the pattern. See: perldoc perlretut and search f

gettting rid of whitespace characters

2011-05-10 Thread Irene Zweimueller
Dear list, I´m relatively new to Perl, so please be patient. I tied to get rid of whitespace characters by the following programme: my $i="USEFUL "; if ($i =~ /\s/) { $i =~ s/\s*//; } print "xx $i xx\n"; and it re

Re: how to rename files that contain chinese characters

2011-04-25 Thread Shlomi Fish
Hi eventual, On Monday 25 Apr 2011 06:22:54 eventual wrote: > Hi, > I am using windows operating system. > I wanted to rename some files within certain directories and my files > contain chinese characters. After renaming, I could not see those chinese > characters, what must I do

Re: how to rename files that contain chinese characters

2011-04-25 Thread eventual
Tks Brian, with the link you provide, I then change the control panel/regional and language settings/language for non-unicode programs to "chinese (simplified prc)" and now I can change files with chinese characters. Thanks From: Brian Fraser To

how to rename files that contain chinese characters

2011-04-24 Thread eventual
Hi, I am using windows operating system. I wanted to rename some files within certain directories and my files contain chinese characters. After renaming, I could not see those chinese characters, what must I do to retain those chinese characters. Below is the file name and the script. Thanks

Re: Mix of English and Cyrillic Characters

2011-04-04 Thread Randal L. Schwartz
> "Barry-Home" == Barry-Home writes: Barry-Home> I am working on a script where I have strings that contain an English string Barry-Home> followed by the Cyrillic translation. "perldoc perluniintro" would be a good start, since you're gonna be knee-deep in unicode issues. And if you have i

Re: Mix of English and Cyrillic Characters

2011-04-02 Thread Brian Fraser
I don't really know the first thing about Cyrillic, so you'll probably have to play around with this before making it work like you want it to. It makes use of Unicode character properties, which you can start learning from perluniprops[0]: $text =~ s/[\p{Cyrillic}\p{Block: Cyrillic}\p{Block: Cyri

Mix of English and Cyrillic Characters

2011-04-02 Thread Barry-Home
Hi, I am working on a script where I have strings that contain an English string followed by the Cyrillic translation. For now, I am looking for a way to strip out the Cyrillic characters and and leave the English ones. I have tried a simple regular expression such as : $text =~ s/Surname

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Thanks for the reading suggestions! Brian Fraser wrote: On Wed, Mar 9, 2011 at 2:22 PM, Brian F. Yulga mailto:byu...@langly.dyndns.org>> wrote: Uri and Jim have hit upon one of my major stumbling blocks with learning Perl. There seems to be a difference of opinion on the proper ti

Re: Using regex special characters from a string

2011-03-09 Thread Brian Fraser
On Wed, Mar 9, 2011 at 2:22 PM, Brian F. Yulga wrote: > Uri and Jim have hit upon one of my major stumbling blocks with learning > Perl. There seems to be a difference of opinion on the proper times to use > hashes vs. arrays/lists...and how best to use them. http://perldoc.perl.org/perlfaq4.ht

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Ben Lavery wrote: > there must be a slight trade-off... the processing required to > initialize the hash table with it's keys and values is probably > more intensive than defining an array with its respective values? > Unless, internally, Perl stores arrays as hashes, with the indexes > as the ke

Re: Using regex special characters from a string

2011-03-09 Thread Ben Lavery
> there must be a slight trade-off... the processing required to initialize the > hash table with it's keys and values is probably more intensive than defining > an array with its respective values? Unless, internally, Perl stores arrays > as hashes, with the indexes as the keys. I would have

Re: Using regex special characters from a string

2011-03-09 Thread Ben Lavery
On 9 Mar 2011, at 03:01, Ben Lavery wrote: > I shall change from a hash to an array and use grep, or looking into it I may > use List::MoreUtils as it has a "first_value" sub which should make it > somewhat more efficient. OK, so about an hour after I wrote this I was on the train home thinking

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Jim Gibson wrote: On 3/9/11 Wed Mar 9, 2011 9:22 AM, "Brian F. Yulga" scribbled: > > foreach ( @word_list ) { if ( /^$temp_word$/i ) { push( > @all_combinations, ( $_ )); } } That is pretty much what the grep function is doing. It has to iterate over the entire array and evaluate its code

Re: Using regex special characters from a string

2011-03-09 Thread Jim Gibson
On 3/9/11 Wed Mar 9, 2011 9:22 AM, "Brian F. Yulga" scribbled: > Uri and Jim have hit upon one of my major stumbling blocks with learning > Perl. There seems to be a difference of opinion on the proper times to > use hashes vs. arrays/lists...and how best to use them. For those that > have he

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Uri Guttman wrote: >> "BL" == Ben Lavery writes: > > > BL> #Here, using a hash looks much cleaner than iterating through an array > > hashes are almost always better for token lookups than scanning > arrays. don't doubt yourself in this area. > > Jim Gibson wrote: > On 3/8/

Re: Using regex special characters from a string

2011-03-08 Thread Ben Lavery
Hi Jim, thanks for replying :) >> >> $word_list{$_} = 0; > > If you assign 1 to the hash value, you can dispense with the 'exists' in > your test, below. >> #Here, using a hash looks much cleaner than iterating through an array >> push(@all_combinations, $temp_word) if (exists $word_list{$temp_w

Re: Using regex special characters from a string

2011-03-08 Thread Jim Gibson
#x27;exists' in your test, below. > } > close(WORDFILE); > > #Set up letters > my @letters = split(//, $ARGV[0]); > > #Used to hold all valid combinations of characters > my @all_combinations; > > #Iterate through the letters > #We then calculate all combinatio

Re: Using regex special characters from a string

2011-03-08 Thread Uri Guttman
> "BL" == Ben Lavery writes: BL> use warnings; BL> use strict; good! BL> use Math::Combinatorics; BL> #Read list of valid words into hash BL> my $WORDFILE='Words'; BL> open(WORDFILE, "$WORDFILE") or die "can't open $WORDFILE: $!"; BL> while () { BL> chomp; BL> $word_l

Re: Using regex special characters from a string

2011-03-08 Thread Ben Lavery
Hi Rob, Thank you for your response, sorry it wasn't as clear as I thought it might have been. > I have a script, and I want to feed it a special thing to let it know that > any character (A-Z or a-z does upper lower case matter?) is valid, but I > also want to use other characte

Re: Using regex special characters from a string

2011-03-08 Thread Rob Coops
Hi Ben, Not sure I get your point... but this is what it sounds like to me. I have a script, and I want to feed it a special thing to let it know that any character (A-Z or a-z does upper lower case matter?) is valid, but I also want to use other characters at the same time. So ./script.pl -s

Using regex special characters from a string

2011-03-08 Thread Ben Lavery
Hi all, I have a script which takes a string of alphabetic characters as an argument, generates all combinations of the characters and all permutations of the combinations, then looks up each result in a list of valid words, if the result is a valid word it gets stored in an array. I would

Re: Regular expression to delete from a string unseen characters

2011-03-08 Thread Dr.Ruud
On 2011-03-06 17:22, Shlomit Afgin wrote: I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. See perldoc perlre, specifically

Re: Regular expression to delete from a string unseen characters

2011-03-07 Thread Rob Dixon
On 06/03/2011 16:22, Shlomit Afgin wrote: I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. Hi Shlomit. It would be better to list

Re: Regular expression to delete from a string unseen characters

2011-03-07 Thread terry peng
> > I have a data that contain unseen characters that I want to delete. > The unseen characters can be ^L, ^N and other sign that I cannot copy but I > see them in my data. > > Is someone know which regular can help me. May you try the "dos2unix" command?

Regular expression to delete from a string unseen characters

2011-03-07 Thread Shlomit Afgin
Hi, I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. Shlomit.

Re: regular expression for special html characters

2011-02-03 Thread John Delacour
At 18:52 +0800 03/02/2011, Jeff Pang wrote: 2011/2/2 Shlomit Afgin : > I tried to convert html special characters to their real character. > For example, converting    ”      to     "   . > > I had the string > $str = "“ test ” ÈÒÈÂÔ†¢ª > The string contain

Re: regular expression for special html characters

2011-02-03 Thread Shawn H Corey
On 11-02-02 04:25 AM, Shlomit Afgin wrote: I tried to convert html special characters to their real character. For example, converting” to " . I had the string $str = "“ test” ניסיון "; The string contain also Hebrew letters. This seems to work: #!/usr/bin/perl

  1   2   3   4   5   6   7   8   >