« first day (69 days earlier)      last day (2330 days later) » 

3:57 AM
do you know any editor which lets me paste on top text and refine and try out regex in the pbottom?
or other way around
 
4:51 AM
so either the plugin is not working or cant parse that regex or my regex is plain wrong
talking about this regex: ^[_a-zA-Z0-9-](\.{0,1}[_a-zA-Z0-9-])*@([a-zA-Z0-9-]{2,}\.){0,}[a-zA-Z0-9-]{3,}(\‌​.[a-zA-Z]{2,4}){1,2}$
 
Oh, sorry, I had forgotten to reply about that.
 
i know my php script was able to fetch email adresses like mail@max-tester.com
wanted to check if it catches as well mails like foo.bar@foo.bar.yarr.com
 
@Videonauth There's RegexBuddy, which is very good and does (seem to) work with Wine, but it's proprietary payware.
What dialect of regular expressions are you using?
 
dunno that particular was made for a php 5.0 script running on apache server
 
Different programs for composing, analyzing, and testing regexes support different dialects. RegexBuddy supports most dialects but there are other programs, free both as in freedom and as in price (or at least one of the two, sometimes) that support fewer but may do what you need.
 
4:54 AM
so i guess its regexp i think
 
@Videonauth Is it using one of the implementations described on this page?
Like, if you're calling functions in php to process regexes, what are the names of some of the functions?
 
I honestly don't remember it anymore if i had to install anything extra for this it worked right out of the box (that project is about 10 jears back)
 
But your regular expressions are in PHP code, right? Or am I missing something? Are they given as input to something implemented in PHP, rather than being as part of its implementation?
If you have the code that they are being used in, you can check what regex dialect is being used.
 
if(ereg($pattern, $_POST['email']))
 
Ok.
 
4:58 AM
$pattern ="^[_a-zA-Z0-9-](\.{0,1}[_a-zA-Z0-9-])*@([a-zA-Z0-9-]{2,}\.){0,}[a-zA-Z0-9-]{3,}‌​(\.[a-zA-Z]{2,4}){1,2}$";
 
That's enough to know the dialect. One of the paragraph on that page says:
> The oldest set of regex functions are those that start with ereg...
(and describes it)
Let's see...
So I don't actually know php at all btw. Is any part of that string quoting? Or is everything that appears between the opening and closing double quote marks the regular expression?
 
there is no subquoting
 
Ok.
Thanks.
 
i have found a plugin for atom vut it does not seem to recognize this regex
 
Does the Atom plugin allow you to adjust the regex dialect?
 
5:00 AM
no sadly not
i wish, because im going through a regex manual actually when i have time
 
Btw, meta question, and you don't have to answer it now: if I move this conversation to another room later, normally I'd move it to the Island, but would you prefer it go to the general room because you'd discussed this regex there previously? If you have zero preference either way I'd move it to the Island (when I move it) but I'm totally willing to move it to AUGR if you prefer.
 
Ok I'll get around to doing that eventually. :)
...Back to the actual regex problem at hand!
 
if youre interested in what book im going through
 
Yes, I am. Thanks!
 
5:04 AM
and hes using some kind of editor who alows him to put text on top and regex on the bottom, i have to try the regex examples from this book still with the atom-plugin
 
Do you need to actually access the text captured by ( ) groups, or are the parentheses just for grouping and not capturing? Like, are you just validating strings, or are you extracting things from them?
 
dont ask me it took me back in those days almost 2 weeks to fiddle this together
 
Well, what's this regex supposed to do?
 
and after that i simply keept this file so precious that i replicated it multiple times over multiple backups
checking if $post[email] is a valid email adress
i.e like mail@max-tester.com
and i know it works tho
but terdon brought up that it might not work for all email adresses
 
The actual full official syntax for email addresses is quite complicated, and even allows for quoting portions of the address. Is there a subset of permitted email addresses that you wish to allow? Like anything that isn't whitespace or a @, followed by a @, followed by anything that isn't whitespace or a @, followed by a . (dot)`, followed by anything that isn't whitespace or a dot, followed by anything that isn't whitespace?
 
5:09 AM
i almost have forgotten all regex i ever learned except the basic stuff
 
2749
Q: Using a regular expression to validate an email address

acrosmanOver the years I have slowly developed a regular expression that validates MOST email addresses correctly, assuming they don't use an IP address as the server part. I use it in several PHP programs, and it works most of the time. However, from time to time I get contacted by someone that is hav...

Right now I'm asking what you consider to be a valid email address for your purposes, more than about what the specific parts of the regex are trying to do.
(The top answer to that question should clarify why I am unsure what you actually mean by "email address" for this purpose. A regex that really matches all valid email addresses is extremely long and complicated, and your program might or might not really be able to use any such email address after allowing it.)
 
Indeed.
 
god beware you did a typo in this
 
Could you just use this method instead to validate email addresses?
145
Q: How to validate an email address in PHP

CameronI have this function to validate an email addresses: function validateEMAIL($EMAIL) { $v = "/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/"; return (bool)preg_match($v, $EMAIL); } Is this okay for checking if the email address is valid or not?

 
5:17 AM
well i just wanted to confirm terdons statement, not using php gain ;) i stepped away from php long time ago
stil finding my way in php but i switched to python nearly completely for most things
simply seems the parser of that plugin cant understand ereg compliant regex, and i doubt its really worth relearning since it seems when it comes to file operations and so on this regex type wont help me
just would have been nice to confirm terdons statement
 
Which one? He said:
in Ask Ubuntu General Room, 11 hours ago, by terdon
It isn't. It will only allow emails like a.foo@ afoo@ but not ab.foo for example.
in Ask Ubuntu General Room, 11 hours ago, by terdon
@Videonauth I don't see how. You only allow one character before the .
in Ask Ubuntu General Room, 11 hours ago, by terdon
And, of course a.b.c@foo.bar.com is also a valid email and that won't allow it.
When I try, it doesn't seem to match anything.
 
all of them and yes for ne neither it seems to match anything, but i know this script is still in use and works for the guy i made it for
 
The ereg functions use POSIX ERE, so I think you can test the regex with grep -E, though GNU Grep will support some things as GNU extensions that POSIX ERE does not support.
 
i guess me and regex will never be good friends :D
 
I hate to say this...
...but let me actually try it with PHP.
Yeah, sorry, I'll move the regex discussion to the Island so the other stuff is easier to see (and so it can be continued, as I do have one idea).
73 messages moved from Raiders of the Lost Downboat‌​
@Videonauth So, when I pasted the regex into an editor to try it in PHP, I was able to see that what I was pasting contained weird Unicode characters!
 
5:48 AM
oh
 
Is it possible that the regex text you are now trying is actually corrupted and different from what you used in the codebase that appears to be working?
 
maybe back in that time i did not use utf-8 encoding for files
or that the chat actually does not like regex being pasted into it
and sanitizes it in a weird way
 
It could be an artifact/bug associated with chat, or maybe even a bug Firefox on my end, I suppose. But I'd definitely look into that. All the characters in it should be representable as ASCII, so I don't know why not using UTF-8 would actually be a problem. Can you provide the regex in some other way than chat? Like in a gist or pastebin or something?
Or if the PHP code is public, you could link to the repo. (I don't know if it is though.)
 
sure
 
Thanks.
 
Yeah, that does not have the weird Unicode stuff in it.
And it does match some things!
Does that explain the behavior of your plugin saying it was an invalid regex, too?
 
no i actually copy and pasted directly from the file
 
Hmm.
 
the plugin doesnt say anything, just dont highlights the one mail adress i know the regex was definetively letting through
 
Well... assuming I understand correctly that PHP ereg is POSIX ERE, you should actually be able to test it with other dialects that support all the POSIX ERE features you're using. With the exception of, like, whether ^ and $ match newlines inside a string, or whether . matches weird whitespace, or exactly what is considered to be in the ranges A-Z and a-z other than the usual 26 capital and lower case letters, other dialects should use your regex the same way.
You might try it with Rubular. That's my favorite online one, even though it doesn't support numerous dialects like RegexBuddy.
 
5:58 AM
yeah i will come back to it when im done with this book
 
Ok.
Well you may also find stuff like Rubular useful while reviewing or learning regular expressions, for practicing with.
 
yes its goot do have alternatives for sure in case the plugin does not cut it
will let you know if i find a good editor like regexbuddy for linux if there is one at all
 
Anyway, I didn't have to actually finish writing or run a PHP program to figure out what was going wrong for me originally. So I'm pretty happy about that! :) :) :)
@Videonauth Well, regexbuddy.com/wine.html, but I imagine you mean something that runs natively on Ubuntu without Wine?
 
@EliahKagan exact
 
Any other requirements? Should it be FOSS?
 
6:02 AM
and i dont like spending money on software since im a pensioner and have to live most months on about 100-150 bucks
n o mustnt be FOSS
most limiting is my financial situation
 
You mean it needn't be FOSS, then? That FOSS is okay but proprietary "freeware" is also okay?
 
exact
 
Ok.
 
best example sublime text where its proprietary but you can use the demo version as long you like
thats what i consider to be an option
13
Q: Recommendation for Regex editor?

TimI asked for recommendations for Regex editors on stackoverflow a while ago. Following is one of the replies: What is "good" depends on what is most useful to you. For me, though, these are the key features for a good regex editor (besides the ability to test and create regular expres...

 
Anyway, I haven't tested the specifics of what he said, but terdon is correct that there are many email addresses, that one is even likely actually to encounter, that the regex you showed does not match. For example, it matches abc@xyz.com but not abc@xy.com, and there are many two-letter domains in use, e.g., bp.com.
 
6:17 AM
yes
back in that time they have not been gibing out 2 letter domains, it was 3 letters min
like i said that script is old
 
Interesting.
 
used that script for a client in about 2006, and made that script even earlies, somewhen between 2004 and 2006
 
There weren't two-letter domains back then?
 
well i dont know then why i inflicted that limit, i know nowadays you can get a two letter domain easily, back then i was doing webhosting and i had all two letter domains rejected from registering
maybe big companys where treated different
 
6:32 AM
Maybe some registrars supported them and others didn't? Or was it just that they were all already registered?
 
given the fact that there are only ~784 possible two letter domains per top level domain
 
Yeah.
 
well what i can speak of are mostly de-nic and com-nic
uk-nic too always rejected attempts to register
co-nic was a bit more lax
 
 
2 hours later…
8:09 AM
@Zanna I dare you to complete ten Project Euler challenges in Bash.
 
@EliahKagan ^_^ not today though
 
Yeah, I don't mean today.
Doing it today is in no way part of the dare. :)
HackerRank actually has Bash as one of its languages.
Of course one way to do it in Bash is to write it in some other language and put it in a here document that is given as input to the interpreter.
 
8:26 AM
Haha :) that's a good tip
 
So you had said you have been learning Python. I hope my "dare" doesn't put you off of that or anything, it's just for fun. I'm also curious -- was your first programming language a shell language?
I hear people saying that learning shell scripting first is easy or a good idea, etc., but I don't know if I've met anybody who actually did it, nor is it at all clear to me that there is any good reason to learn shell scripting first. So I'm curious.
 
 
1 hour later…
9:51 AM
38 messages moved from Raiders of the Lost Downboat‌​
 
 
2 hours later…
12:04 PM
The only language I know how to write any code in at all is Bash (unless sed counts), and I don't know much of that. I won't be put off trying to learn Python, I just hope I will be more conscientious about doing so than I am right now :)
 
12:18 PM
@Zanna Shells are such weird languages though!
So, not having learned other languages before Bash, when you write Bash scripts, are you not constantly filled with a feeling that shell scripting is super weird?
Because I constantly feel that way.
I am not sure I have asked that question very well.
 
12:42 PM
I do not know of any good informal way to reason about what a shell command means. People sometimes say that shell scripting is easy to learn but I have never understood why they think so. In a so-called "real programming language" like C or Python, the language's structure is conceptually similar to natural language in a way that shell scripting is not.
If natural language used parameter expansion, then understanding the sentence, "Feed the dog," would entail replacing "the dog" with the actual dog it represents and putting that actual dog into sentence. That's impossible because in life we talk about things besides text; conversations can be about things other than themselves.
* into the sentence
 
1:21 PM
I don't feel that shell scripting is weird, but I usually feel amused and delighted when I try to understand or do something in other languages, because it seems so clear and simple. But sometimes it also seems very laborious, like an overly long explanation
@EliahKagan lol
 
1:33 PM
Laborious, you say?
>>> import os, glob
>>> os.chdir('src')
>>> for f in glob.glob('*tar*'):
...     print(f)
...
zinf.tar.xz
bash-92.1.2.tar.gz
bash_4.3.orig.tar.gz
bash_4.3-14ubuntu1.2.debian.tar.xz
>>>
:)
 
1:56 PM
>>> import re
>>> r = re.compile('(?i)lsb')
>>> with open('/var/log/boot.log', 'r') as f:
...     for line in f:
...         if r.search(line):
...             print(line, end='')
...
[  OK  ] Started LSB: AppArmor initialization.
         Starting LSB: daemon to balance interrupts for SMP systems...
         Starting LSB: Record successful boot for GRUB...
         Starting LSB: automatic crash report generation...
         Starting LSB: loads/unloads the sep3_15 driver at boot/shutdown time...
In case you are wondering, I'm kidding. Even simple code like that is quite laborious compared to using the shell. (Though the second one is sort of reverse-cheating since I could call grep from Python.)
 
 
3 hours later…
5:08 PM
In the case of me trying to write code though, I tend to asssume that the laboriousness isn't caused by the language :)
 

« first day (69 days earlier)      last day (2330 days later) »