For some reason though, I can't get it to work. Here's the code I'm using.
Here's the first few text blocks of my log file#!/usr/bin/perl use warnings; use strict; my $input_data = "real.txt"; my $output_data = "output.txt"; open(FILE, $input_data) or die "Cannot open file $input_data because: +$!"; my @text = <FILE>; close(FILE); foreach my $line (@text) { if ( $line =~ /([A-Z]+) *- *([^-]+) *- *([^"]+)"([^"]+)".+?([0-9]+)$ +/sm ) { print "CATEGORY $1\n\n"; print "KEYWORDS $2\n\n"; print "Summar text: $3\n\n"; print "Reference: $4\n\n"; print "Id: $5\n\n"; } else { print "none"; } }
Any idea what I'm doing wrong?ABETALIPOPROTEINEMIA ABETALIPOPROTEINEMIA - Vitamin A, Vitamin E - In a study of 10 subjects who were 3-25 years of age (mean age 14.6 years) who were diagnosed with abetalipoproteinemia during their first year of life and from then on received 100 mg of vitamin E/kg and 10,000-15,000 IU/day of vitamin A compared with 10 age-matched control subjects, levels of plasma carbonyls did not differ significantly between patients and controls. The lag phase of plasma oxidizability was 28.03 minutes in the treated subjects compared with 24.0 minutes in the healthy subjects. Cyclic voltammetry showed a peak potential of 330 mV in all the samples studied, which suggests that the same antioxidants were present in the plasma of the patients and the control subjects. The anodic current of the samples, which measures the concentrations of hydrophilic low-molecular-weight antioxidants, was 5.227 versus 5.38 uA in the patients and control subjects, respectively. These data suggest that enhanced oxidative stress is not apparent in the plasma of abetalipoproteinemia patients receiving long-term supplementation with vitamin A and E. It is noted that the neurologic and ophthalmologic symptoms of abetalipoproteinemia are believed to be, in part, caused by alpha- tocopherol deficiency. "Oxidative Stress in Abetalipoproteinemia Patients Receiving Long-Term Vitamin E and Vitamin A Supplementation," Granot E, Kohen R, Am J Clin Nutr, 2004;79:226- 230. (Address: Esther Granot, E-mail: etgranot@md.huji.ac.il) 41401 ABORTION ABORTION - Spontaneous, Caffeine - In a review of 15 epidemiologic studies, all of which suffered from important methodologic limitations, most reported a positive association between maternal caffeine intake and the risk of spontaneous abortion. However, the authors conclude that the evidence must be considered equivocal, since these biases would tend to overestimate any association. "Maternal Caffeine Consumption and Spontaneous Abortion: A Review of the Epidemiologic Evidence," Signorello LB, McLaughlin JK, Epidemiology, March 2004;15(2):229-239. (Address: Joseph K. McLaughlin, E-mail: jkm@iei.ws) 41684
In reply to Re^2: Working with regexes
by Anonymous Monk
in thread Working with regexes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |