Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Regex problem: period not matching newline in s///s?

Posted on 2004-08-10
1
Medium Priority
?
586 Views
Last Modified: 2011-09-20
Here's my perl script:

#!C:/perl/bin/perl.exe -Wpi.orig
s#<RD:Documento>([0-9]{1,4})( D\.?P\.?R\.? )([0-9]{1,4})(.*Juez.*</TA>)#<RD:Documento>$1$2$3$4\n<CM>HTMLINSERT:<a href="/Download/DPR4/Sumarios_Escolios/Tomo$1/$1DPR$3-Escolio.pdf" target=centerframe><center><font face=Arial size=1>Ver Escolio</A></CM>\n#s;

And here's my text file, between but not including "---"s:
---

<RD>Así lo pronunció y manda el Tribunal y lo certifica el señor Secretario General. El Juez Presidente señor Andréu García y el Juez Asociado señor Negrón García inhibidos. El Juez Asociado señor Rebollo López no intervino. <CM>LineFeed</CM>

<RD><CM>LineFeed</CM>

<RD>Francisco R. Agrait Lladó, Secretario General <CM>LineFeed</CM>

<RD><CM>LineFeed</CM>

<RD><PB>
<RD>
<RD:Documento>135 DPR 259 --  In Re: Colton, Villanueva, Miró, Figueroa, Brunet
<RD>
<RD>
<TA:1,1; JU:LF; BR:AL:0.00972222,0.0298611,HZ:0.00972222,0.0298611,VT:0.00972222,0.0298611>
<RO><CE: HI; VA:CN><JU:CN><CM>HTMLINSERT:<a href="/Download/DPR4/135/135_259.DOC" target=centerframe><center><font face=Arial size=1>Grabar la Decisión</A></CM>
</TA>

<RD>
<TA:2,1.5,3.5; JU:CN; BR:AL:0.00972222,0.0298611,HZ:0.00972222,0.0298611,VT:0.00972222,0.0298611; SD:255,255,0>
<RO><CE: MR:1; SD:0,0,128><JU:CN><CM>C Ta info</CM>
<BD+><FC:255,255,255><BC:DC>Información del Documento<IT+><FC><BC></CE>
<RO><CE><FT:Arial,SR><PT:8>Partes:<BD></CE><CE><FD:Nombre>In re: Pedro Colton Fontán, Osvaldo Villanueva Díaz, Aurelio Miró Carrión, Angel Figueroa Vivas, Juan E. Brunet Justiniano</FD:Nombre></CE>
<RO><CE><BD+>Fecha:<BD></CE><CE><FD:Fecha><HD+>3/4/1994</FD:Fecha><HD>4 de marzo de 1994<BD+></CE>
<RO><CE>Cita:<BD></CE><CE><FD:DocID><HD+> 135DPR259</FD:DocID><HD->  135 DPR 259</CE>
<RO><CE><BD+><HD>Juez:<BD><HD-></CE><CE> <FD:Autor><BD-> Resolución</FD:Autor><BD+></TA>

<RD>
<RD:Seccion>Opinión
<RD>
<RD:Pagina>Página: 259
<RD>
<RD>CE-86-666<CM>MJSEP</CM>
<HR>
<RD><CM>MJSEPEND</CM>
Conducta Profesional<CM>MJSEP</CM>
<HR>
---

According to this app I downloaded, The Regex Coach, the regex matches a good chunk of the file, specifically from the beginning of the line starting with <RD:Documento> until the end of the line that contains "Juez", but the script does nothing.  When I fiddle with the regex to pinpoint the problem, I find that up to the end of the third expression it does match as I expect, but when I add in the fourth, (.*Juez.*</TA>), it stops working. Does it have something to do with the newlines that should be matched by that expression?

Thanks!
0
Comment
Question by:madacebo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 11768315
Try
#!C:/perl/bin/perl.exe -0777 -Wpi.orig
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question