LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-29-2009, 12:08 PM   #16
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454

Quote:
Originally Posted by JoeBleaux View Post
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.

Then you may get an answer.

Otherwise you are just waisting our time.
 
Old 04-29-2009, 11:33 PM   #17
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Code:
s/[^A-Za-z0-9@.-_\s]+//g
--- rod.
 
Old 04-30-2009, 06:46 AM   #18
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
Quote:
Originally Posted by theNbomr View Post
Code:
s/[^A-Za-z0-9@.-_\s]+//g
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.
 
Old 05-01-2009, 10:20 AM   #19
JoeBleaux
LQ Newbie
 
Registered: Mar 2009
Distribution: Slamd64
Posts: 26

Original Poster
Rep: Reputation: 15
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.
 
Old 05-01-2009, 12:04 PM   #20
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by JoeBleaux View Post
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').
 
Old 05-01-2009, 12:16 PM   #21
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
Quote:
Originally Posted by Sergei Steshenko View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to handle odd characters in sed maker10 Programming 6 07-02-2008 03:15 PM
Parenthesis and other odd characters passed to bash function jakeo25 Programming 2 04-03-2008 10:27 AM
spaces and odd characters in directory name in bash? babag Programming 1 04-02-2008 03:28 PM
Limiting RAM usage in a perl script DanTaylor Programming 2 05-05-2006 02:37 PM
Java JTextArea - limiting amount of characters entered Andy@DP Programming 3 03-10-2004 01:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration