Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Recent content by kwa

  1. K

    @XPREPLACE (4UTILS) issues?

    Great stuff mate - thanks so much for that. I'll download it and give it a workout this afternoon.
  2. K

    @XPREPLACE (4UTILS) issues?

    Hi again, sorry for not replying earlier - been sick. I'll think and get back. But I want to ask this one more time, because it solves multiple problems. Is there no way you'll consider a pass-by-reference convention for the 3 string parameters? Simply put: a) XREPLACE(..., FRED,...)...
  3. K

    @XPREPLACE (4UTILS) issues?

    Here's an example of why imho something has to be done regarding quotes. The testcase I've been using is this: echo %@XREPLACE["^^(.*)two",REPLACE,"one two three one two three"] That's (imho) an entirely natural way to use XREPLACE. I quoted the third string because it contains spaces...
  4. K

    @XPREPLACE (4UTILS) issues?

    I can confirm that the test case I posted now works as expected: echo '%@XREPLACE["^^(.*?)two",REPLACE,"one two three one two three"]' ^(.*?)two REPLACE "one two three one two three" 'REPLACE three one two three"' What is the middle line? Is XREPLACE echoing its parameters to stdout?
  5. K

    @XPREPLACE (4UTILS) issues?

    Wow..fast work Vince - I'll download it and check it out now. I was thinking some more about the escape processing. I'd prefer not to have it, as the strings being processed are nothing to do with tcc (they come from a third party supplied text file). But I could understand if others saw it...
  6. K

    @XPREPLACE (4UTILS) issues?

    I've never used SED. so I cant draw any parallels with that. We have to be careful with terminology here - greediness/non-greediness works fine in regexes using the ? qualifier, notwithstanding that there's apparently a problem with the above example I gave that uses it (which is probably...
  7. K

    @XPREPLACE (4UTILS) issues?

    On reflection, that wouldn't be backwards compatible, would it? How would XREPLACE know if a prefixed quote was part of the actual text to be passed to Oniguruma (as I understand is the case now, therefore required for backward compatibility), or a delimeter to be stripped (new)? To...
  8. K

    @XPREPLACE (4UTILS) issues?

    So can someone give me the definitive answer of why: echo '%@XREPLACE["^^(.*?)two",REPLACE,"one two three one two three"]' produces: 'REPLACEREPLACE three"' ? (the reason that text substitution was done, not the quotes) When doing this on a java regex tester (eg.this) you have...
  9. K

    @XPREPLACE (4UTILS) issues?

    Yes I know that. But the point is that, in doing so, the resultant value will be subject to expansion before it is passed (which you might not want), and may also contain characters that break the syntax of the command line/function. This can easily be the case if the text came from user input...
  10. K

    @XPREPLACE (4UTILS) issues?

    Yes that's true, but at least it eliminates the majority of unwanted expansions, in my (admittedly limited) experience anyway. In what I've been playing with, I'm getting input from the user, or a text file, then manipulating it in various ways (including regex testing and passing through...
  11. K

    @XPREPLACE (4UTILS) issues?

    I don't think I explained myself very well. I meant that I could pass XPREPLACE the *name* of a variable, not its value, thereby avoiding any expansions in its value by tcc. The above both pass foo by value. Say for example (I'm just inventing a syntax for the purpose of illustration here)...
  12. K

    @XPREPLACE (4UTILS) issues?

    Makes sense to me! I'm not yet familar enough with tcc to know what I'm talking about here, but I've seen that you can pass the name (rather than value) of a variable to some things, using %[name] - so it occurred to me that, if it were possible to do this with XREPLACE, that would avoid...
  13. K

    @XPREPLACE (4UTILS) issues?

    I think I see what is happening now. In the non-greedy example XREPLACE is finding two matches of the regex '^^(.*?)two' in the string 'one two three one two three' as shown by blue and red. This surprises me because the second one isn't at the start of the string, so ^ isn't being respected...
  14. K

    @XPREPLACE (4UTILS) issues?

    I should have mentioned that removing the non-greedy specifier, ie. change (.*?) to (.*), does then leave it working as expected, apart from the quote issue anyway: echo '%@XREPLACE["^^(.*)two",REPLACE,"one two three one two three"]' gives: 'REPLACE three"' as the capturing group is now...
  15. K

    @XPREPLACE (4UTILS) issues?

    First post, so firstly hello everyone! I've been playing with TCC/LE and 4UTILS, and am having trouble working out why @XREPLACE does what it does. For example, take this: echo '%@XREPLACE["^^(.*?)two",REPLACE,"one two three one two three"]' As far as I understand it - and I've checked...
Back
Top