Conversation
Notices
-
Anyone good at regular expressions? How do I say "match this string unless it also matches this other string"?
Monday, 04-Feb-13 12:05:51 UTC from web-
@toksyuryel You can match my string any day
Monday, 04-Feb-13 12:06:18 UTC from web-
@mrdragon Let me just slip into this Spitfire costume…
Monday, 04-Feb-13 12:16:04 UTC from web-
@toksyuryel Sure you don't want me in that?
Monday, 04-Feb-13 12:21:59 UTC from web-
@mrdragon I thought you wanted Spitfire, not wanted to BE Spitfire?
Monday, 04-Feb-13 12:23:36 UTC from web-
@toksyuryel Why not change it up for once?
Monday, 04-Feb-13 12:25:53 UTC from web-
@mrdragon Why don't you both wear the suits? *grins deviously*
-
@bitshift Because let's be honest, they wouldn't be on long
Monday, 04-Feb-13 12:32:16 UTC from web-
@mrdragon If you take them off you're doing it wrong.
Monday, 04-Feb-13 12:33:00 UTC from web-
@toksyuryel *ripped off
Monday, 04-Feb-13 12:38:40 UTC from web-
Monday, 04-Feb-13 12:39:55 UTC from web
-
-
-
@mrdragon Oh, wouldn't they~? You underestimate how... persuasive I can be.
-
@bitshift I'm an animal
Monday, 04-Feb-13 12:48:53 UTC from web-
@mrdragon I bet you are~
-
@bitshift Oh my
Monday, 04-Feb-13 12:53:38 UTC from web-
-
Monday, 04-Feb-13 13:05:26 UTC from web
-
-
Monday, 04-Feb-13 13:18:44 UTC from web
-
-
Monday, 04-Feb-13 13:23:31 UTC from web
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@toksyuryel Put the parts which aren't allowed in a [^] block?
-
@bitshift The problem arises from needing to check that the string to match is not contained within the string to not match. Specifically, I am trying to match the first # symbol that is not inside quotes.
Monday, 04-Feb-13 12:10:27 UTC from web
-
-
@toksyuryel Might be easier to come up with a concise one if I knew what the specific strings were.
-
@bitshift The string to match is '\s*#.*' and the string to not match is '".*#.*"'
Monday, 04-Feb-13 12:11:16 UTC from web-
@bitshift I recognize that this breaks when a quote is escaped, but I'd like to take this one step at a time (and I found a snippet that allows for escaped quotes so hopefully finding the solution to the simpler problem will teach me whatever I need to know to work that into the final result).
Monday, 04-Feb-13 12:13:02 UTC from web -
@toksyuryel Hmm... '[^"]*#[^"]*' ?
-
@bitshift This will match when there is a quote character after the # even if there isn't one before it. (I am being generous here- this actually barely matches anything at all, but I understand what you meant to type)
Monday, 04-Feb-13 12:19:04 UTC from web-
@toksyuryel Ah, yes. I think you'd have to use a look-backward expression, if that's even available. I don't see why it'd match very little, though; the [^"] blocks ought to match any non-" character.
-
@bitshift You didn't allow for any characters to separate the quotes and the #
Monday, 04-Feb-13 12:23:11 UTC from web-
@toksyuryel Oh, right. Sorry, I'm not so good without access to a reference and/or a means of testing.
-
@toksyuryel Maybe I could help with this when I get home, if you're still stuck?
-
@bitshift Sounds good *hug*
Monday, 04-Feb-13 12:28:54 UTC from web-
@toksyuryel In the meantime, if the flavour of regex you're using (I assume grep's) supports enough of it, I suggest http://www.regular-expressions.info/lookaround.html
-
@bitshift sed actually
Monday, 04-Feb-13 12:33:13 UTC from web -
@bitshift According to that article, you can't use repetition or optional items inside a lookbehind.
Monday, 04-Feb-13 12:39:33 UTC from web-
@toksyuryel Dang. I'll leave it until I get home and can have a proper think about it, then.
-
-
-
-
-
-
-
-
-
@toksyuryel This would be a lot easier if I had a way to test on mobile, heh. I /think/ that ought to work, though.
-
@bitshift I have recognized a flaw in my comparison idea which basically means it's not going to work anyway even if there was a way to do it that way. It looks like what I actually need to do is count up the number of quotes, and only match if an even number of quotes precedes the first # and I don't think that's something a regular expression can do. Time to break out awk.
Monday, 04-Feb-13 13:50:27 UTC from web-
@toksyuryel I really need to learn how to work with that, heh. I'm continually amazed by what it can do in the right hands. :)
-
@toksyuryel I think a regex with sufficiently strong lookaround capabilities probably could. It'd be a horrendous mess, though, so far better to break out awk. :)
-
@bitshift No amount of lookaround will satisfy this case: VAR="quoted value" # comment with an "embedded quote" in it
Monday, 04-Feb-13 14:06:55 UTC from web-
@toksyuryel If you did multiple alternatives via non-capturing groups, I think you could just about do it. It would be a terrible, terrible idea, is all. :b
-
-
-
@toksyuryel But yeah, for sure a regex is not the right tool here.
-
-
-
-
@snowcone Not really. Pretty vanilla if you ask me.
Monday, 04-Feb-13 20:40:15 UTC from web-
@toksyuryel @snowcone Careful, now, yous twos.
Monday, 04-Feb-13 20:40:41 UTC from web-
@scribus I assume I know where the line is, but I've been wrong before.
Monday, 04-Feb-13 20:43:24 UTC from web-
@toksyuryel I don't distrust you, just giving a heads up.
Monday, 04-Feb-13 20:45:05 UTC from web-
@scribus I generally use "Boast Busters" and "Putting Your Hoof Down" as a yardstick for what's acceptable. Do you feel that's accurate?
Monday, 04-Feb-13 20:48:39 UTC from web-
@scribus Could probably include "A Canterlot Wedding" in that list too, now that I think on it.
Monday, 04-Feb-13 20:49:15 UTC from web-
@toksyuryel Anything that can be cited in the show will almost certainly be cool. (Not saying "definitely" because I don't want anyone dropping racism on us and saying "But they were racist against Zecora, so it must be fine to be racist!" or anything similar) :P
Monday, 04-Feb-13 20:57:18 UTC from web-
Monday, 04-Feb-13 20:58:36 UTC from web
-
Monday, 04-Feb-13 21:01:41 UTC from web
-
@pony "à la". 's French. :)
Monday, 04-Feb-13 22:20:27 UTC from web-
@bitshift ah thank you x3 My italian messes up my french
Monday, 04-Feb-13 22:22:04 UTC from web
-
-
-
-
-
-
-
-
-
-
-