Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Possible to have regexes act on file directly (not in memory)

by Nocturnus (Beadle)
on May 05, 2014 at 06:28 UTC ( [id://1085002]=note: print w/replies, xml ) Need Help??


in reply to Re: Possible to have regexes act on file directly (not in memory)
in thread Possible to have regexes act on file directly (not in memory)

When mentioning the start tags and end tags, I was just giving an example to illustrate the problem at theoretical level. In this example, I wouldn't be allowed to make assumptions even on the size of the tags.

In reality, anyways, the patterns are different from what I mentioned in the example. They are more complicated, but I will undoubtedly be able to write a state machine based mini-parser to solve the problem. This approach will make porting the respective application to other programming languages much easier; the disadvantage is that I will have to change the software if I am given other or further patterns to search for (right now, I don't have the time and interest for writing my own parser for some general search pattern language, so I will hard-code a search algorithm for each pattern into my mini-parser).

Being able to run regexes directly on the source files would just have been a way which is by far more comfortable, faster (in the sense of "When is the software ready?") and general and which would allow for new search patterns without changing the software.

Thank you very much,

Nocturnus

  • Comment on Re^2: Possible to have regexes act on file directly (not in memory)

Replies are listed 'Best First'.
Re^3: Possible to have regexes act on file directly (not in memory)
by LanX (Saint) on May 05, 2014 at 14:28 UTC
    > They are more complicated, but I will undoubtedly be able to write a state machine based mini-parser to solve the problem.

    You are aware of pos, right?

    > In reality, anyways, the patterns are different from what I mentioned in the example.

    If you can't produce a "real" example its better to let this thread die now. Plz don't keep people speculating.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    update

    see also XY Problem

      As far as I have understood, pos won't help because it works in conjunction with regular expressions, and (as this thread has shown clearly enough), this always means loading to memory which is not an option in my case. Please correct me if I am wrong.

      While I appreciate any help and while I would like to thank you explicitly for taking the time, I can't resist commenting on the XY problem:

      I am not one of the guys who try to let others work for them. I will never shout "Hi everybody, I have problem X, please find as many solutions as possible to that problem for me". Instead, I am trying to work out a set of possible solutions, in this case writing my own parser which acts directly on the files being one of these and trying to use regular expressions which directly operate on the files being a second one.

      Since I know how to do the former, and since I didn't know how to do the latter or even if the latter is feasible at all, I just asked for the latter one.

      By full intent, I do not want others to solve my problems; instead, I am aware that the others' time is a precious resource and thus try to only ask the things I don't know and couldn't research myself after having put great efforts on it. IMHO, this is not only perfectly acceptable, but I honestly think that more people should act in this manner.

      Furthermore, at philosophical level, the solution to every problem is to not want to solve it. Thus, if I had given you the "root" problem, what would prevent you from saying: "Hey, this again is an example for people asking for Y when they mean X. You really don't need to solve that problem. Search for other customers or go to holidays with your family."?

      Finally, my question was clear, precise and specific; I think I even wouldn't have needed to give the example to understand the problem. As the others' contributions have shown, they have understood the essence of the problem very well, and I think that most of them did so as soon as having read the headline. People who don't understand the problem at theoretical or example level won't be able to help at all.

      Looking into a problem at theoretical or example level does not have anything to do with speculation.

      Thanks again,

      Nocturnus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1085002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2024-04-23 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found