« first day (561 days earlier)      last day (3231 days later) » 

 
4 hours later…
7:22 AM
@Jerry hi..
if i run your perl code, it shows Global symbol "$line" requires explicit package name at f line 6.
error.
 
yep, the last line contains the string print
But the above error shows for me , i think it's because of some libraries.
i failed to import.
 
7:48 AM
@Jerry that asterisk can be replaced as a plus
 
*should
 
:)
 
yea, I took OP's original regex and changed it rather than write a new one
 
8:01 AM
@Jerry i came up with the same regex you wrote(2nd one). But it failed on run on my machine. So i didn't try to post that..
 
there is no 2nd. What do you mean?>
it is one regex with interchangeable parts
 
\G
regex with ^^
 
the first one in the code is the regex of the OP
 
yep,,
 
so I have only 1 regex
not 2
 
 
7 hours later…
3:27 PM
Help please! JavaScript sucks!
0
Q: Why does this regex replacement not work for JavaScript, but instead only work for other engines?

UnihedronI want to build a javascript function that transforms text into another format, from this: MATCH 1 1. [4-17] `public direct` 2. [18-29] `routing.key` MATCH 2 1. [35-41] `direct` 2. [42-52] `routingkey` To this: MATCH 1: [Group 1: public direct] [Group 2: routing.key] MATCH 2: [Grou...

 
3:41 PM
solved, don't mind it, I'm stupid
 
Hi guys, I want t to convert 1/2 + 1/3 + (2+3)/4 + {2+4}/{3+4} etc.
to \frac{1}{2} + \frac{1}{3] + \frac{2+3}{4} + \frac{2+4}{3+4}
Any ideas how to write a regex that matches these different patterns ?
I have this now: var re = new RegExp("([^}]{1})(\/)([^{]{1})", "g");`
var re = new RegExp("([^})]{1})(\/)([^{(]{1})", "g");`
or this one, that basicly says if there is no } or ) before the / and no { or ( after the / then just treat it like the case a/b
 
... + \frac{1}{3] ... the bracket is broken
 
oh sorry, it is \frac{1}{3}
 
3:56 PM
So you want a replacement that expression1, /, expression2 should become \frac{expression1}{expression2}?
Define what the expressions can be for me... numbers plus numbers, minus numbers, and?
 
everything, unicode +-* letters/digits everything I can think about, and if there are no {} or () surroudning the expression, than I just want to use the first and last symbol as ab/cd should become a\frac{b}{c}d
and (ab)/cd should become \frac{ab}{c}d
 
Gotcha, can I have test cases?
 
not sure what you mean with test cases
 
A list of input -> expected output examples for testing.
 
I have this now: jsfiddle.net/8pstcsrb
ah, well '1/2 + 1/3' => '\frac{1}{2}+\frac{1}{3}'
'(1+2)/34' => '\frac{1+2}{3}4'
'1+2/{345}' => 1+\frac{2}{345}
'(1+2)/(3+4) => \frac{1+2}{3+4}'
'{123}/{21312}' =>'\frac{123}{21312}'
I have to move to another building, I'm back in 5 min.
 
4:21 PM
wow !
@Unihedron that really seems kind of genius
 
@Kasper There's not much I could do since we're in JavaScript.
 
@Unihedron I updated my answer to your question. PCRE documentation reports this as well.
1
Q: Why does this regex replacement not work for JavaScript, but instead only work for other engines?

UnihedronI want to build a javascript function that transforms text into another format, from this: MATCH 1 1. [4-17] `public direct` 2. [18-29] `routing.key` MATCH 2 1. [35-41] `direct` 2. [42-52] `routingkey` To this: MATCH 1: [Group 1: public direct] [Group 2: routing.key] MATCH 2: [Grou...

 
@Unihedron I'm trying to understand it now. I actually also would to convert things like (abc)/d where a,b,c and d can be numbers/letters/strange unicode character, binary operations, whatever
should I just replace \d with . ?
 
@hwnd Ah, amazing! I never knew about that. Thanks for the information! It's golden.
@Kasper When in doubt try it out :) regex101 is quick
 
4:44 PM
@Unihedron I fail :P
@Unihedron (?:([^{}()])|(([^{}()]+(?:\+[^{}()]+)?))|{([^{}()](?:\+[^{}()]+)?)})\/(?:([^{}‌​()])|(([^{}()]+(?:\+[^{}()]+)?))|{([^{}()]+(?:\+[^{}()]+)?)})
I've got this
 
(facedesk) now you have three problems
 
:P
ooops
this is the regex
but I feel like I should do anything with \+
regex101.com/r/cL0iZ9/3 this is where it fails
 
that seems to work perfect !
@Unihedron thank you so much helping :) and showing that amazing usefull tool
 
great, well done on getting it to work!
 
 
1 hour later…
6:17 PM
some regex pros here ?
 
maybe
 
this is what I'm trying : regex101.com/r/tV5jM1/1
 
what should it do?>
 
I want to replace the first string with the string after =>:
^1 => ^{1}
^1^2 => ^{12}
^1^2^3 => ^{123}
^1^2^2^2 => ^{1222}
^1^2^2^2^9 => ^{12229}
and so on
 
nvm
 
6:29 PM
I don't need more than 10 times.
It doens't go to infinity
 
@Kasper can you use this: regex101.com/r/tV5jM1/2
?
@Kasper what language are you using?
 
javascript, I look at it, thanks
 
then
 
the whitespace doesn't matter, but I do need {...}
 
@Kasper then just newvar='^{'+replaced+'}'
 
6:43 PM
there's no way afaik to remove and add things at different positions with a single regex.
 
no need to complicate it more than that
 
@CSᵠ sounds great !
 
the simplest would be something like result = "^{" + s.replace(/\^/g, '') + "}";
uh, I haven't used normal string replace in a while
 
oh but wait I've got code like:
Let x^1^2^3 in ℝ, blabla bla then x^1^2^3 = y^1^2^3. Not sure how to get the "^{" thing in the right place now.
 
wait
MathJax
 
6:49 PM
hmm, yea, normal string replace will replace only the first occurrence
 
 
you might use a function then, uhh, let's see if I remember how to do that
 
@CSᵠ I know mathjax. :P I use it at my website. But I'm making some CoffeeTeX kind of language.
Therefore I need to do those kind of things, to convert the CoffeeTeX to LaTeX.
hard to explain in a few setences
 
results = text.replace(/(?:\^\d+)+/g, function($1) {
    return "^{"+$1.replace(/\^/g,"")+"}";
});
 
6:54 PM
ok then, back to basics
:)
 
uhh, I just took a snippet I used in the past. the $1 should be able to be substituted by a more appropriate variable name
like m for match.
 
@Jerry works perfect it seems !
 
:)
 
@Kasper what about jsfiddle.net/geeoxvtv/1
 
I see ^x^ in the output, so it must be good :D
 
7:00 PM
@CSᵠ In my editor it isn't possible to do that.
to try it, type something like $x¹²³$, you can press superscript by pressing and holding digits
 
cool :)
 
like press and hold 1, to get ¹
But there only superscript/subscript unicode symbols for numbers I believe.
 
you you have to click the number each time or?
*do you
like when I get the little menu when I hold 1
 
you can press 1 again, and then you go through the menu
or you can use arrows
and then tab to select it
or enter
or spacebar :p lots of different options
 
oh ok, so left/right
up/down weren't working
I think it's a bit counter-intuitive though, since the little menu is below, just my opinion
 
7:07 PM
@Kasper cool!
you're eating up spaces btw...
morning @HamZa
 
ahh it's been a while I haven't written LaTeX
still like the way math is rendered :3
 
@Jerry I could also add up down as well. Heard someone else saying that as well
@CSᵠ eating up spaces ?
my pc was down for a minute :p
 
7:26 PM
@CSᵠ evening
 
@Kasper awesome :)
heya HamZa how are ya
 
tired. Worked today and I need to work tomorrow...
How about you?
 
ouch :( you get paid overtime hopefully?
same. Have been working on a large file the whole week
had to do some processing on it and it was taking 2-3 hours for each modification
 
it's not overtime for me...
I study through the week and usually work the weekend and some evenings
 
except didn't work today, fortunately.
ah, so study full time, work part time
 
7:30 PM
Correct
 
I was doing the reverse last year. Will also have to do that again in some time
taking a 'break' right now xD
 
nice
 
What a trick ... https://github.com/godka/SOchatStatistics/blob/master/so_chat_parser.php#L5
I had to think about it :P
 
7:56 PM
@HamZa thnx, been fiddling much with operators, conversions, datatypes in php lately
i really don't like if isset { set } else { init} nor the full ternary isset?get[]:0;
bla.
 
 
2 hours later…
10:01 PM
@CSᵠ nice POV
 
pov?
point oif view?
 
yeah
 
 
1 hour later…
11:06 PM
@HamZa does the icon on the left side of the menu bar show up pretty clean?
 
@hwnd yes, tested in FF and Opera (chrome engine)
Wait, isn't the newest FF using the chrome engine o_O?
 
Yea I believe
@HamZa you recommend any other color suggestions?
 
@hwnd I'm really not a design guy. The current design is clear, simple, solid. For me it's ideal
 
11:23 PM
OK, thanks.
 
11:46 PM
@hwnd RD clean&straight
 

« first day (561 days earlier)      last day (3231 days later) »