Giter Site home page Giter Site logo

string.find matching error about luerl HOT 8 CLOSED

rvirding avatar rvirding commented on July 28, 2024
string.find matching error

from luerl.

Comments (8)

rvirding avatar rvirding commented on July 28, 2024

It was a bug in parsing character sets in patterns. It has been fixed in commit 3d22db5.

from luerl.

loucash avatar loucash commented on July 28, 2024

This looks good, thank you.
I saw yet another difference:
lua:

> print(string.find('<a><b>1</b><c a="1">2</c></a>', '^([^<]*)<(%/?)([^>]-)(%/?)>', 4))
4   6    b

luerl:

> luerl:do("print(string.find(\"<a><b>1</b><c a=\\\"1\\\">2</c></a>\",\"^([^<]*)<(%/?)([^>]-)(%/?)>\", 4))").
nil

from luerl.

rvirding avatar rvirding commented on July 28, 2024

It was a bug in how the beginning of string anchor '^' was handled when not starting at the beginning of the string. It now follows Lua. It has been fixed in commit 5c1feb7.

from luerl.

loucash avatar loucash commented on July 28, 2024

I still experience those differences:

> print(string.find("<a>1</a>", "^([^<]*)<(%/?)([^>]-)(%/?)>", 4))
4   8   1   /   a
> luerl:do("print(string.find(\"<a>1</a>\",\"^([^<]*)<(%/?)([^>]-)(%/?)>\", 4))").
4 8 < a >

from luerl.

rvirding avatar rvirding commented on July 28, 2024

You haven't heard the adage: I had a problem so I used regular expressions, now I have two problems. I will check but I am guessing I just counted wrong as the chars are one position off.

from luerl.

loucash avatar loucash commented on July 28, 2024

Ha! I hope i will soon get to know this part good enough to send not only bug reports, but also patches ;-)

from luerl.

rvirding avatar rvirding commented on July 28, 2024

I was counting the offsets incorrectly. It now works on all your 3 test cases so far. It has been fixed in commit 63833f8.

If you have any cases to test for string.match, string.gsub and string.format please run them as well.

from luerl.

loucash avatar loucash commented on July 28, 2024

That worked! Here is my little side project as POC of how someone can use luerl, xml parser: https://github.com/loucash/luerlxml

from luerl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.