
zohar81
New User
Mar 6, 2008, 7:11 AM
Post #1 of 2
(445 views)
|
|
regexp question:
|
Can't Post
|
|
Hello, i'd like to detect all the lines that their first alpha-numeric word repeats more then once. for example: this line would be 'hits' abc sda asd asd abc aaa bbb ccc aaa aaa unfortunately i only find how to do it in more than one code line. meaning that at first i extract the first word, and then i make the replacements. $string =~ m/(\w+)/; $string =~ s/$1/$replace_string/; i don't know how to count the number of occurrence of the first line. so i'll hit only the lines that their first word repeats itself at some point. i also believe that there is more elegant way to do it. thanks,
|