ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sergei, thank you for your replies but, I am not a programmer and I do not have that mindset. I try and do as little coding as possible.
'RTFM' replies do me no good. I need examples of how things work. I have read Perl docs until my eyes bleed and I do not understand them (same with man pages), they are useless to me. I need examples to understand.
Telemachos reply, "/[^-A-Za-z0-9@._]/" explains it all to me...
// = This is a regex
^ = not the following
-A-Za-z0-9@._ = allowed characters
[] = match the characters inside these.
I understand.
54 lines of Perldoc gibberish just confuses me. It is the same as Greek.
I think you do not understand how to express what you do not understand.
As I said, start reading the 54 line, and ask the question about the first thing you do not understand.
For whatever it's worth, I thought that the OP wants to catch and reject usernames that include bad characters (rather than just cleaning them out with a substitution). I was imagining an input in a loop. The loop doesn't move forward until the user enters a valid username. 'Valid' in this case means simply free of bad characters. I may be wrong though about the OP's intentions.
Last edited by Telemachos; 04-30-2009 at 06:54 AM.
Telemachos, you are correct. When someone enters a username, I wanted it to be checked for any dis-allowed characters (everything except [A-Za-z0-9@.-_]). It just had to find (match) one dis-allowed character so I could use an if statement to reject the username and tell them to try again.
Reading it in one character at a time isn't what I wanted but, it's easy enough to use your regex to do what I wanted.
I just have a problem getting my head around regex-es and the manuals are not written for non-programmers.
Telemachos, you are correct. When someone enters a username, I wanted it to be checked for any dis-allowed characters (everything except [A-Za-z0-9@.-_]). It just had to find (match) one dis-allowed character so I could use an if statement to reject the username and tell them to try again.
Reading it in one character at a time isn't what I wanted but, it's easy enough to use your regex to do what I wanted.
I just have a problem getting my head around regex-es and the manuals are not written for non-programmers.
Huh ?
Perl, as many others, is a programming language, so the target audience is programmers. It would be illogical to expect a manual written for non-programmers.
Anyway, I haven't yet seen any particular question related to the already mentioned 54 lines (line #712 until line #765 in 'perldoc perlop').
Anyway, I haven't yet seen any particular question related to the already mentioned 54 lines (line #712 until line #765 in 'perldoc perlop').
For god's sake, let it go. He doesn't like the manual. He isn't going to send you any questions about the 'already mentioned 54 lines.' It's over. Let's all open a beer and enjoy the sunset.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.