Posts: 13
Joined: Jan 2010
Reputation:
0
2010-01-28, 03:15
(This post was last modified: 2010-01-28, 03:34 by tronics.)
is there a way to do substitutions with the <RegEx> syntax? I can't seem to see any reference to it in any doc I have read only pattern matching.
Looking to do something akin to s/Pattern/Replacement/
very basic example would be say change all 'a' to 'b'
s/a/b/g
something like that. Is there a way to accomplish this with the current implementation? If not what src files should I look at to add it?
Edit: while I am asking what about translation ie change all chars to upper case like
tr/[a-z]/[A-Z]/
Posts: 4,997
Joined: May 2004
Reputation:
12
It's a regexp, not sed. REs are only capable of matching and substring extraction. Since you didn't mention what exactly you're trying to do, I won't guess.
Posts: 4,997
Joined: May 2004
Reputation:
12
WHERE are you trying to do this? We use REs in dozens of places. How am I supposed to know what you're actually trying to accomplish and perhaps present you with an alternate solution which IS supported? No one has required something like this in the 8yrs previous, leading me to believe there's another way to do whatever you're attempting. Adding it wouldn't really make sense and won't likely be accepted. If you want some similar feature I'd suggest a new class with a sed-like feature set and syntax. Though I offer no guarantee that this would be accepted.
I wasn't being elitist and not telling you where the sources were. I missed that you'd asked it. Sorry! I know exactly where they are (quite cleverly named too), I was probably the last person to touch them. Since you decided to be a smart ass and make a personal attack, I will now be elitist and not tell you.
Posts: 13
Joined: Jan 2010
Reputation:
0
2010-01-28, 09:19
(This post was last modified: 2010-01-28, 09:28 by tronics.)
Don't worry about it. I found the code on my own and already implemented a solution. I don't know why you guys (XBMC developers) always have to have such poor attitudes. You act as if you are the only ones with a brain. I wasn't asking for something absurd or foolish and considering you are using the PCRE lib it is a simple SIMPLE modification to allow for substitution. It is simply a matter of calling pcre_exec with the compiled regex describing the pattern and then replacing the chars in the input string with the desired replacement chars between the indices returned in the offset vector from that call. You make it sound like a major rewrite, it is not. Anyway, for me problem is solved, thanks for nothing.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
I'm still not sure what you are trying to achieve, and more importantly why you are trying to achieve it. It sounds as if you require an extension to the scraper engine (supposedly a simple extension) but without knowing why you require this I can't comment as to whether it's something that should be done or not, or how it should be done.
Given that you've now done it yourself, perhaps you could elucidate as to the why?
Cheers,
Jonathan