#trying to create a regex to completely remove ALL instances of \r or \n at the end of a line
31 messages · Page 1 of 1 (latest)
make it global and multiline.
global allows the regex to match multiple times (normally it will only match once)
multiline allows ^ and $ to match the beginnings and ends of lines (normally ^ and $ are the beginning and end of the entire input string)
tbf, $ isn't actually needed at all since with m it's just defined as being after \n
you'll only ever realistically encounter \n or \r\n, \r is really outdated, so you could just use /\r?\n/g
oh soryy i didnt mean to say end of line i just need to remove all /r/n or /n from the end of a string
i see
i'll have to get back to you, gotta go do something rq
if i don't come back in like, 10 minutes ping me because i'd probably have forgotten it
cool thx
@clever creek
yep i forgot just as predicted
aight here we go
your regex seems correct with that, i can't replicate the issue either
what code are you using?
also make sure to save and restart
im using latestComment.body.replace(/(\r|\n)+$/, "")
but there are always some \r\n left over
show more code than that
how are you seeing that some are left over
output
the \r\n are still there 😦
i just want to make it so it ends like All graphic issues have been fixed....
URL finder is just a regex that matches URL's
could you move your logs to right under finalCommentBody
to isolate 1 issue at a time, in case there's multiple
ok
i have to do something rn ill be back
Could it be that you remove all from the end but then cut off more because of the substring so those that are there in the end were in the middle originally?
i think its exactly that 