Reg Ex question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reg Ex question
# 8  
Old 12-02-2008
previous will only work if there is only 2 words inside quotes.

This one should work with:

Code:
$str = 'This "sentence is" a combination of "multiple words"';

while($str=~/"([^"]+)"/g) {push @quoted,$1;} # fetch quoted words
foreach(@quoted){
$word=$new=$_;
$new=~s/\s/+/g;  ##inserting '+'
$str=~s/$word/$new/;
}
@str1= split (/\s+/,$str);
$_ =~ s/\+/ /g foreach(@str1) ;

print "$_\n" foreach(@str1);

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

REG Expression

Need your help in creating regular expression for particular set. let say I have given two dates 20130623 to 20140625. I need to create regular for the dates which fall in between above two dates. (4 Replies)
Discussion started by: gvkumar25
4 Replies

2. Windows & DOS: Issues & Discussions

Question regarding Reg entries

Since I cannot find a ffmpeg build that will automatically include a environment variable for the CMD ffmpeg command I'll probably have to do it myself. However I would like to do so by saving it inside a .reg file. For example if my path towards FFMPEG is: C:\RESOURCE\FFMPEG\ffmpeg.exe ... (5 Replies)
Discussion started by: pasc
5 Replies

3. Shell Programming and Scripting

Sorting - Reg.

Hi masters, I have one doubt, lets's say file1 has the following contents, 1 2.0 3.1 5.5 7 5.10 5.9 How to sort these contents to get the o/p like 1 2.0 3.1 5.5 5.9 5.10 7 (8 Replies)
Discussion started by: ecearund
8 Replies

4. Solaris

Reg. VXVM

Hi Guys, I have a doubt either to Reboot the server after Replacing the disk0. I have two disks under vxvm root mirrored and i had a problem with primary disk so i replace the disk0 failed primary disk and then mirrored. After mirroring is it reboot required ? (7 Replies)
Discussion started by: kurva
7 Replies

5. UNIX for Dummies Questions & Answers

Reg: MAILX

Hi all, I am trying to send a mail by using MAILX option to my YAHOO-Id. It is giving the following error. Can any one help me to find what is the problem? Do i need to get any kind of settings in my UNIX box for using MAILX? The bounce mail is as below: Message 1: From MAILER-DAEMON Tue... (2 Replies)
Discussion started by: Raamc
2 Replies

6. Shell Programming and Scripting

reg exp question

Hi, Should be a difference between ']]*' and ']+' ? I use them in bash with sed and grep. Thanks (1 Reply)
Discussion started by: ynir
1 Replies

7. Shell Programming and Scripting

Reg expression For

HI system.sysUpTime.0 : Timeticks: (1519411311) 175 days, 20:35:13.11 From the above output i need only 175days in a perl script.. Please Help (2 Replies)
Discussion started by: Harikrishna
2 Replies

8. Shell Programming and Scripting

need a help reg -d in shell

hi, I am using this to get previous month `date -d"1 month ago" "+%m"` But will it work for january?..will it return 12? Please advice. (2 Replies)
Discussion started by: vanathi
2 Replies

9. Shell Programming and Scripting

Reg: Gzip

Hi , I want gzip a folder te55 which has got 3 files test1.test2,test3 the name of the gzipped folder should be te55.gz with the 3 files as test1,test2,test3 itself... Is it possible... thanks in advance sam (5 Replies)
Discussion started by: sam99
5 Replies

10. Shell Programming and Scripting

reg files

Dear all, One of our jobs retrieves data from tables and writes it to files. This job was running for around 15 minutes for the past 8 months. Now, this job is runnig for 45-50 minutes. I checked with the DBA's and found no issues with database. The time taken by to job to write to the file is... (5 Replies)
Discussion started by: ranj@chn
5 Replies
Login or Register to Ask a Question
PURITY(6)							   Games Manual 							 PURITY(6)

NAME
purity - a general purpose purity test SYNOPSIS
/usr/games/purity [ flags ] [ testname ] DESCRIPTION
Purity is an interactive purity test program with a simple, user interface and datafile format. For each test, questions are printed to the your terminal, and you are prompted for an answer to the current question. At a prompt, these are your choices: y Answer "yes" to the question. n Answer "no" to the question. b Backup one question, if you answered it incorrectly, or someone is watching you take the test, and you don't (or do) want to admit a different answer. r Redraw the current question. q Quit the test, and print the current score. ? Print a help screen for the current prompt. k Kill a section of the test. This skips all the questions of the test until the next subject heading. a Toggle answer mode between real answers and obfuscated answers. Real answers print "yes" and "no", while obfuscated answers are "Maybe" and "maybe". Obfuscated answers are preferred if you are shy, and don't want people to be able to read your answers over your shoulder as you take the test. d Toggle dERanGe output. s Print your current score on the test you are taking. l Toggle score logging. At the end of the test, your score is printed out. For most purity tests, lower scores denote more "experience" of the test material. FLAGS
These are the command line flags for the test. -a Show real answers (i.e. "yes" and "no") instead of obfuscated ones (i.e. "Maybe" and "maybe") as you answer the questions. -d PrINt THe tESt in DerANgeD pRInT. -f Take the test in fast mode. Only the questions are printed, and not any other text blocks, like the introdution, subject headers, and the conclusion. -l Take the test without having your score logged. -p Print the test without prompting for answers. This is useful for making hard copies of the tests without having to edit out the prompts by hand. -r Decrypt the test using the Rot 13 algorithm. This is done as a form of "protection", such that if you read a rot13 test and it offends you, it's your own fault. -z zoom through more prompts in large text blocks. The default is to prompt the user for more when a screenful of text has been printed without any user input. DATAFILE FORMAT
The format of the datafiles is a very simple format, intended such that new tests can quickly and easily be converted to run with the test. There are four types of text in a purity test datafile. Each type is contained in a bracket type of punctuation. The definitions are as follows: the styles of text blocks are: { plain text block } [ subject header ] ( test question ) and < conclusion > Plain text blocks are printed out character for character. Subject headers are preceded by their subject numbers, starting at 1, and then printed as text blocks. Questions are preceded by their numbers, and then prompt the user to answer the question, keeping track of the user's current score. Conclusions first calculate and print the user's score for the test, then print out the conclusion as a text block. If you wish to include any of the various bracket punctuation in your text, the backslash ("") character will escape the next character. To print a question with parentheses, you would use the following format: (have you ever written a purity test (like this one)?) the output would be this: 1. have you ever written a purity test (like this one)? and then it would have asked the user for her/his answer. For a generic datafile, use the "sample" datafile for the test. FILES
/var/games/purity.scores the score logfile /usr/share/games/purity/* test data files AUTHOR
Eric Lechner, lechner@ucscb.ucsc.edu 18 December 1989 PURITY(6)