RegEx Substitutions?
#1
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]/
Reply
#2
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.
Reply
#3
althekiller Wrote: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.

LOL typical friendly response. I thought I was quite clear as to EXACTLY what I was trying to do, but let me be explicit. "I would like to replace character(s) matching some pattern described by a regular expression from an input string with different character(s) of my choosing".

I suspect the answer is NO xbmc's regex capability is too limited to handle such "advanced" features and you would rather act all elitist rather than admit you do not know the answer to my question as to what src files to modify to add this functionality. Typical.
Reply
#4
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.
Reply
#5
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.
Reply
#6
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
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
RegEx Substitutions?0