<mynameisdebian>
Suppose I have an e-mail “na@something.com”, and I want to see if some text contains na@something.com, but not “ana@something.com”, and not “banana@something.com”. However, there could be not alphanumeric characters in front of the e-mail. How can I search for this with Ruby?
<mynameisdebian>
non-alphanumeric I meant
<havenwood>
mynameisdebian: Regexp is one way.
<Radar>
regexp: /\Ana@something.com\z/
<Radar>
If all your text was just that email
<Radar>
mynameisdebian: example input and output would be helpful here
<mynameisdebian>
yeah, I just need to verify I’m on the right page
<mynameisdebian>
I have some text. If the text contains a string variable eMail I do something. However, if it contains any string concatenated with eMail I do nothing.
<mynameisdebian>
unless the “connecting” characters to a concatenated string are non-alphanumeric
<havenwood>
mynameisdebian: That's ^ beginning of string, zero or more non-alnums, followed by that emails address and end of string.
<mynameisdebian>
how can I search a string for that regex and get a bool?
<havenwood>
mynameisdebian: string.match? //
<mynameisdebian>
thx
<mynameisdebian>
one sec
nielsk has quit [Ping timeout: 246 seconds]
<mynameisdebian>
thank you very much, still working on this
troulouliou_div2 has quit [Read error: Connection reset by peer]
dviola is now known as Guest54440
Guest54440 has quit [Ping timeout: 252 seconds]
cyberRodent has quit [Ping timeout: 250 seconds]
cagomez has joined #ruby
cyberRodent has joined #ruby
dviola has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fluxAeon has joined #ruby
mynameisdebian has quit [Quit: mynameisdebian]
mynameisdebian has joined #ruby
mynameisdebian has quit [Client Quit]
dviola has quit [Quit: WeeChat 2.2]
mynameisdebian has joined #ruby
mynameisdebian has left #ruby [#ruby]
duderonomy has joined #ruby
ivanskie has joined #ruby
fluxAeon has quit [Ping timeout: 268 seconds]
ajsharma has joined #ruby
gheegh has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
fluxAeon has joined #ruby
duderonomy has joined #ruby
braincrash has quit [Quit: bye bye]
Dimik has quit [Ping timeout: 245 seconds]
braincrash has joined #ruby
podlech has quit [Quit: WeeChat 1.9.1]
za1b1tsu has joined #ruby
Fusl has quit [Remote host closed the connection]
Fusl has joined #ruby
darkhanb has joined #ruby
dviola has quit [Quit: WeeChat 2.2]
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LiftLeft2 is now known as LiftLeft
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang6- has joined #ruby
hahuang65 has quit [Ping timeout: 260 seconds]
weaksauce has quit [Ping timeout: 268 seconds]
nadir has joined #ruby
c0ncealed3 has quit [Remote host closed the connection]
c0ncealed3 has joined #ruby
cagomez has quit [Remote host closed the connection]
ajsharma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
armyriad has joined #ruby
asphyxia has joined #ruby
MoritaShinobu has joined #ruby
orbyt_ has joined #ruby
sauvin has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Remote host closed the connection]
reber has joined #ruby
kapil____ has joined #ruby
orbyt_ has joined #ruby
internetfriend has joined #ruby
<internetfriend>
hello
<internetfriend>
friends
<internetfriend>
<3
internetfriend has quit [Client Quit]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MyMind has joined #ruby
Sembei has quit [Ping timeout: 250 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
vonfry has joined #ruby
Nicmavr has joined #ruby
vonfry has quit [Remote host closed the connection]
vonfry has joined #ruby
vonfry has quit [Quit: WeeChat 2.2]
vonfry has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has quit [Ping timeout: 252 seconds]
dogweather has joined #ruby
desperek has joined #ruby
erratic has quit [Quit: this server has gone to sleep]
za1b1tsu has joined #ruby
braincrash has quit [Ping timeout: 272 seconds]
elcontrastador has quit [Ping timeout: 245 seconds]
Exagone313 has quit [Ping timeout: 272 seconds]
aloy has quit [Ping timeout: 272 seconds]
aloy has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
braincrash has joined #ruby
Exagone313 has joined #ruby
zapata_ has joined #ruby
zapata has quit [Ping timeout: 252 seconds]
dogweather has quit [Quit: dogweather]
phaul has joined #ruby
rubydoc has joined #ruby
nowhereman_ has quit [Ping timeout: 250 seconds]
Mike11 has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
Mike11 has quit [Quit: Leaving.]
nowhereman_ has joined #ruby
DarthGandalf has quit [Quit: Bye]
AKPWD has quit [Quit: じゃね。]
DarthGandalf has joined #ruby
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
varesa has quit [Ping timeout: 250 seconds]
AKPWD has joined #ruby
fribmendes has quit [Quit: Ping timeout (120 seconds)]
fribmendes has joined #ruby
za1b1tsu has joined #ruby
conta has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
varesa has joined #ruby
sameerynho has joined #ruby
TomyLobo has joined #ruby
<phaul>
baweaver: still here? how would I match against a mixed structure like [?a, {b: ?c}] in Qo? ?c should be with Any, but I want to assert ?a and :b.
<baweaver>
What's the actual data look like?
<phaul>
I have a [String, Hash] just like [?a, {b: ?c}]
<phaul>
and I know that the first key in the hash is the one I want to match on
<baweaver>
Likely: Qo[Any, Qo[b: Any]]
<phaul>
ok but I need ?a would this work then : Qo[?a, Qo[b: Any]] ?
<baweaver>
phaul: Don't use ?a
<baweaver>
use 'a'\
<baweaver>
? is too esoteric for common use
<phaul>
ok but I need ?a would this work then : Qo['a', Qo[b: Any]] ? :)
<baweaver>
?a and 'a' are the same thing
<ruby[bot]>
baweaver: I don't see no and, whom should I tell about a?
<baweaver>
odd bot
<baweaver>
Why does your data look like that?
<phaul>
ok this worked Qo[?a, Qo[b: Any]]. Thanks for your help.
<baweaver>
phaul: stop using ?a
<baweaver>
It's really a bad habit to get into
<phaul>
would you care to elaborate why
<baweaver>
It's esoteric and hard to find what it does
<baweaver>
So for any newer Rubyist it's an instant headache trying to find what it is
<baweaver>
Though I'm still curious why your data is basically a nested hash unfolded into Array tuples
<phaul>
baweaver: ASTs sometimes tend to look like that :)
roshanavand has joined #ruby
c0ncealed3 has quit [Remote host closed the connection]
<phaul>
anyways thanks for the Qo help. You might want to add such examples to the readme, at least one where a Qo[] embeds an other Qo[]. I guess it falls out of most Qos matching if the sub thingy itself matches with ===, but it jjust didn't occure to me to embed Qos in each other.
c0ncealed3 has joined #ruby
postmodern has quit [Quit: Leaving]
roshanavand has quit [Quit: leaving]
roshanavand has joined #ruby
roshanavand has quit [Client Quit]
roshanavand has joined #ruby
roshanavand has quit [Client Quit]
roshanavand has joined #ruby
roshanavand has quit [Client Quit]
roshanavand has joined #ruby
conta has quit [Quit: conta]
roshanavand has quit [Client Quit]
roshanavand has joined #ruby
nowhereman_ has quit [Ping timeout: 244 seconds]
roshanavand has quit [Client Quit]
ta_ has quit [Remote host closed the connection]
apeiros_ is now known as apeiros
venmx has joined #ruby
za1b1tsu has joined #ruby
reber__ has joined #ruby
reber has quit [Ping timeout: 250 seconds]
DTZUZO_ has quit [Ping timeout: 252 seconds]
za1b1tsu has quit [Ping timeout: 244 seconds]
venmx has quit [Remote host closed the connection]
ta_ has joined #ruby
troulouliou_div2 has joined #ruby
venmx has joined #ruby
venmx has quit [Ping timeout: 244 seconds]
graphene has joined #ruby
ta_ has quit [Ping timeout: 252 seconds]
troulouliou_div2 has quit [Remote host closed the connection]
themsay has joined #ruby
nowhereman_ has joined #ruby
ellcs has joined #ruby
vonfry has quit [Quit: WeeChat 2.2]
nowhereman_ has quit [Ping timeout: 252 seconds]
ellcs has quit [Ping timeout: 252 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
za1b1tsu has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
dbugger_ has joined #ruby
dbugger_ is now known as Dbugger
Puffball has quit [Remote host closed the connection]
Puffball has joined #ruby
clemens3 has joined #ruby
gheegh has joined #ruby
leah2 has quit [Ping timeout: 252 seconds]
dbz has joined #ruby
za1b1tsu has joined #ruby
dbz has quit [Ping timeout: 244 seconds]
GodFather has joined #ruby
P1RATEZ has joined #ruby
Dimik has joined #ruby
<za1b1tsu>
regarding ruby and cli input. I would like to be able to be able to right multiple lines as input, but leave Enter for when it's finished. Something like Ctrl+[ (or other keybind) for new line. Is it possible? Any tips?
<phaul>
za1b1tsu: what are you using to get cli input? there is gets. there are gems to do smart cl interfaces etc
<za1b1tsu>
I wanted to have the ability to edit some default input, so I am using some readline hack, I don't really understand how it works. Does something with the hook. I'm trying to keep my gem usage limited for now.