Regular expressions crash the program

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
User avatar
notuo
Posts: 258
Joined: Sat Jul 09, 2005 8:07 pm
Location: Tlalpan, Mexico City, Mexico

Regular expressions crash the program

Post by notuo »

Hi Karlis.

I just tried a search with regexp and rapidphp (Version 7.1.0.6) went down, vanished. I am sure the regexp was wrong because I am learning this technique.

Here is what I tried first:

Code: Select all

<i>.*</i>
and found extrange things Stoped at the first <i> but ended at the last </i> instead of the correspoding one. I repeat, I am new in this.

Then I tried:

Code: Select all

<i>(.)*</i>
and got a beep and rapid crashed.

Also and continuing with this subjet. What are the sw you have for this regexp. I like to have more examples of the syntax and commands. The help part is short in this.

Thanks for your help and maybe you can fix this.

BTW, here is an excerp of the file I am testing with.

Code: Select all

        <p>La Conferencia General de la Organización de las Naciones Unidas para la Educación, la
        Ciencia y la Cultura, denominada en adelante la UNESCO , en su 32ª reunión, celebrada en
        ParĆ­s del veintinueve de septiembre al diecisiete de octubre de 2003,</p>

        <p><i>RefiriƩndose</i> a los instrumentos internacionales existentes en materia de derechos
        humanos, en particular a la Declaración Universal de Derechos Humanos de 1948, al Pacto
        Internacional de Derechos Económicos, Sociales y Culturales de 1966 y al Pacto
        Internacional de Derechos Civiles y PolĆ­ticos de 1966,</p>

        <p><i>Considerando</i> la importancia que reviste el patrimonio cultural inmaterial, crisol
        de la diversidad cultural y garante del desarrollo sostenible, como se destaca en la
        Recomendación de la UNESCO sobre la salvaguardia de la cultura tradicional y popular de
        1989, así como en la Declaración Universal de la UNESCO sobre la Diversidad Cultural de
        2001 y en la Declaración de Estambul de 2002, aprobada por la Tercera Mesa Redonda de
        Ministros de Cultura,</p>

        <p><i>Considerando</i> la profunda interdependencia que existe entre el patrimonio cultural
        inmaterial y el patrimonio material cultural y natural,</p>

EDIT>>>

Just tried this regexp in Ultraedit (unix style) and worked fine

>>>>
Regards
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Post by Karlis »

.* means "everything", so it will fit any text, if you need <i>{something}</i>, you need to have your expresssion written so that it is anything except <

so it would be <i>[^>]*</i> which means any string, but stop at <

Now I do agree that the software must be more tolerant for incorrect expressions and should not crash, so your report will be taken into account.
Karlis Blumentals
Blumentals Software
www.blumentals.net
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Post by Karlis »

Very strange, I did as you told and the program did not crash... maybe it was some other expression that caused the crash?

P.S. Regexprs are almost PERL style.
Karlis Blumentals
Blumentals Software
www.blumentals.net
User avatar
notuo
Posts: 258
Joined: Sat Jul 09, 2005 8:07 pm
Location: Tlalpan, Mexico City, Mexico

Post by notuo »

Thanks for your answer. I did the same with this piece of code and didn't crashed. The actual file is 840 lines.You can grab it here
http://www.ims.com.mx/karlis.rar

Crashes with this file and this exp:

Code: Select all

<i>(.)*</i>
Regards
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Post by Karlis »

Thanks, this will help definately!
Karlis Blumentals
Blumentals Software
www.blumentals.net
Post Reply