I am doing  exercise on CodeEval. I have submitted my code a number of times but the maximum score I seem to get each time is 95. There are 20 test cases(email addresses) that the site runs against a submitted code. This means that there is one particular email in which one my code is giving the wrong answer to. Below are my 2 functions (which have given me the highest score yet, of 95) for checking a valid email. The difference with each is that each time I'm trying out a different regex:  FUNCTION 1  private static boolean isValid(String str) {     Pattern pattern = Pattern.compile("^[a-zA-Z0-9.!#$%&amp;'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$", Pattern.CASE_INSENSITIVE);     Matcher emailAddress = pattern.matcher(str);     return emailAddress.matches(); }   FUNCTION 2  private static boolean isValid(String str) {     Pattern pattern = Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);     Matcher emailAddress = pattern.matcher(str);     return emailAddress.matches(); }   I have tried to do some research on regex on here and with some books and it seems like the concept of regex is not necessarily exact when it comes to validating email addresses. The hope is to validate ALMOST all email address. However, CodeEval seems to think otherwise. I tried using the regex from  but their online editor/compilers complained of 100+ errors with that regex. My question is, is there some other regex that surely validate EVERY single email under the sun? Thank you in advance for any comment(s)/answer(s)
Over the years I have slowly developed a  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 having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs).  What is the best regular expression you have or have seen for validating emails?  I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function.
How do I install a .tar.gz (or .tar.bz2) file? A woman's butt was allegedly touched by a man several times during a commute on the MRT.   How to use butt, bottom, buttock and ass? I am confusing with these words. I'm looking for a way to get the Default currency symbol (in a none-multi-currency org) of the salesforce org locale (to have it displayed on a visualforce page in a field that can't be &lt;apex:inputField&gt; or &lt;apex:outputField&gt;) preferably query-able from apex (via the database, a describe or whatever) and then again the actual symbol, meaning € for Euro, $ for dollar, and so on...  There must surely be some sort of mapping hidden in the code somewhere salesforce does this via the input/outputfields if bound to an sobject of type currency  Can anyone point me in the right direction? Is there an easy way to change filetype association? After the upgrade to 11.10 I've had the problems that    all music-files would open with banshee, which then crashed all folders would open with konsole   The first problem I  after installation of "ubuntu tweak" "> admin > filetype Associations".. Changed back to totem.  The second was somehow not accessible this way (did not give any possibility to add commands).  I've changed the line "inode/directory=nautilus-folder-hanlder.desktop" to "inode/directory=nautilus.desktop" from "/usr/share/applications/defaults.list" and now everything works fine.  Question: More convenient ways to do that? How can I configure the Ubuntu Dock to show windows only from the current workspace? I would like my Dock to show only the windows of the current workspace. Especially in the little preview window. I find it very confusing to jump around workspaces when trying to find the right window. Wire transfer to an intermediary bank account I sent money from a bank that doesn't have a space for intermediary bank, so I put the intermediary bank statement information where the beneficiary bank information is supposed to be.  I  don't know what will happen now. Is there a way to stream Netflix content to my Ubuntu machine? What is a good general document size for web page mockups and prototypes? I do mockups and prototypes of sites and designs all the time, but I've always wondered if there is a standard size or width I should be using. Generally I'll make my document either 1024, 1200, or 2560px wide, depending on what I'm doing.  So what do you think? What is a good or standard size for this? Colorize symbols with lstdefinelanguage in latex How do I blend a black-background fire image in Photoshop? This fire image:    As you can see, it has a black background, which I can't delete (because it would probably destroy the smooth-looking fire effect). I want to place some fire in a photo.  However, I remember it was possible to take such images and do something in photoshop so that when you place them over a photo, the black is gone and the fire is perfectly blended there. But I can't remember what feature or option was it. Any ideas?  Photoshop CS5. How do I find the files installed by a particular package? Where is the .deb file to look at? I have installed pulseaudio-module-bluetooth using apt.  $ type pulseaudio-module-bluetooth bash: type: pulseaudio-module-bluetooth: not found $ which pulseaudio-module-bluetooth $ whereis pulseaudio-module-bluetooth pulseaudio-module-bluetooth:   Clearly, I'm looking for the wrong thing.  The package does not simply install a command that is the same name as the package.  Alright, then.  I want to find out what all commands (or executables) this package installed, and their locations.  The answers to "" tell me how to find the files installed by the package if I have a .deb file.  I'm not installing directly from a .deb file, though.  I'm using apt.  Where is the .deb file that that used?  Is there a copy on my system somewhere that I can query with the commands in the answers to that question?  Where?  If there isn't a local copy on my system, can I get one with apt?  How?  Is there some handy apt (or similar) command that wraps this up for me, so that I do not have to run dpkg-deb directly?  What is it?  Can I find the package's file list entirely on-line, without explicitly downloading any .deb files and before installing anything with apt?  How? Select organic group on the user registration form There's a post already on the post installation forum, but I'm not sure if this is a OG bug.   I am using Drupal 7 and OG 7.x-2.1 version. There is no "Group Audience" in the manage fields page and I think it is replaced with "Group membership", the field type is "Entity Reference" and the widget is "OG Reference". Also there is no input type in the field setting page and I can not find any field that has a "Always show other groups" option. I have checked the option "Show on registration form of that field, but the combo box on the registration form does not have any option. Any suggestion? pass 1 environment variable using sudo Is this a correct way for passing an environment variable in sudo ?  sudo -u www-data -b env FOOBAR="foobar" /home/user/folder/daemon Use grep to find content in files and move them if they match Adding admin-ajax.php to the frontend. Good or bad idea? I love admin-ajax.php. But I hate having to localize in order to point frontend scripts to it, and I wish there was an equivalent, easy-to-find file for themes. (It also just bothers me to see frontend requests go through "/wp-admin/". No practical reason, just looks ugly IMO.)  So I've simply copied admin-ajax.php to the root dir at "/ajax.php", adjusted the include paths and removed the WP_ADMIN constant definition. Seems to work like gangbusters (I can now just direct all my frontend AJAX requests to /ajax.php! And I can still use the normal wp_ajax hooks in my plugins!).  But is this safe? What might go wrong? Since this isn't built into core, I assume there's a good reason as to why not. But looking through the code, I can't see any immediate problems.   You're smart--tell me if this approach is crazy. Or if there's a simpler method that I'm overlooking. Working in a group blender project Justify text inside itemize environment with beamer class Bash script to remove the oldest file from from a folder I want to make a bash script to delete the older file form a folder. Every time when I run the script will be deleted only one file, the older one. Can you help me with this? Thanks SSH login with clear text password as a parameter? I need to login to a user that I've created on a remote host running Ubuntu. I can't use an ssh key because the ssh login will happen from a bash script ran within a server that I won't have access to (think continuous integration server like Bamboo).   I understand this isn't an ideal practice, but I want to either set the remote host to not ask for the password or be able to login with something like ssh --passsword foobar user@host, kind of like MySQL allows you to do for logins.   I'm not finding this in man ssh and  I'm open to any alternatives to getting around this issue. Prove $\gcd(a+b, a-b) = 1$ or $2\,$ if $\,\gcd(a,b) = 1$ I want to show that for $\gcd(a,b) = 1$ $a,b \in Z$   $\gcd(a+b, a-b) = 1$ or $\gcd(a+b, a-b) = 2$ holds.      I think the first step should look something like this:      $d = \gcd(a+b, a-b) = \gcd(2a, a-b)$   From here I tried to proceed with two cases. 1: $a-b$ is even, which leads to $\gcd(a+b, a-b) = 2$ 2: $a-b$ is odd, which leads to $\gcd(a+b, a-b) = 1$  My main problem I think is, that I do not know how I should include $\gcd(a,b) = 1$ in the proof.  Any help is appreciated. Thx in advance. Cherio Woltan