I  need a regular expression for phone numbers. The phone numbers may contain special characters like +, ., /, -, space, (, ), [, ].  Some Examples:  (+91) 9864081806 (+91)9864081806 (+91)(98640)81806 +91.98640.81806 [+91]09864081806 +91.986.408.1806 +91-986-408-1806 Maximum numbers = 15   The special characters can exists anywhere in the code. An opening bracket should have a closing one.  I have created this pattern but it does not work:  preg_match('/^[\[\(\0-9\s.\_\-\+\/\)\]]{3,15}$/', $phone_no)
I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:   1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.
How do I know whether my bike can use disk brakes? Laurent series expansion Let $p, q \in \mathbb R$ be positive reals for which $p + q = 1$. How to prove that for any two natural numbers $n, m$ the following inequality is true?  $(1 - p^n)^m + (1 - q^m)^n \ge 1$  I don't have a big knowledge about solving inequalities, so I tried to use cauchy-schwarz inequality, binomial theorem and some other baisc techniques, but it lead me nowhere. I've been thinking about it for a long time and now I'm completly stuck. How does the Doctor know how old he is? I've often wondered, how does the Doctor know how old he is? He not only travels through time, but also through space, and visits planets where days can be shorter or longer than 24 hours. How does he 'keep score'?  Also, does he count his age in Earth years or Gallifrey years? They might be completely different in length. Problem: Let $f$ be defined for all real $x$, and suppose that   $$|f(x)-f(y)|\le (x-y)^2$$  for all real $x$ and $y$. Prove $f$ is constant.  Source: W. Rudin, Principles of Mathematical Analysis, Chapter 5, exercise 1. Showing that the sample mean and variance are independent by showing two distribution are the same Why am I getting "line 1: $' :\r': command not found"? I use Cygwin on my laptop (DOS). I have a collection of scripts from my colleagues, and my own. I am not an IT person, not knowledgeable in Unix. I am following my colleagues' syntax and able to manage a few simple things. The scripts worked well on my old laptop. I just changed laptop and installed Cygwin. When I run my scripts, they do not work. Here is one example of the error message I get: line 1: $':\r': command not found line 5: syntax error near unexpected token `$'\r'' line 5: `fi  Here are the top 5 lines of my script : iter=1 if [ -f iter.txt ]    then rm ./iter.txt  fi    Can someone please explain how I can get around this problem? A property of every real polynomial. Question: For every polynomial $P(x)$ of degree at n we have $$\sum_{i=0}^{n+1}(-1)^i\binom{n+1}{i}P(i)=0$$  Well I was inducting on degree of the polynomial, for $n=0$ its true and I got a bit confused in the inductive step, actually I cant figure the inductive step.   Is this property (if true) a famous one?  Thank you for your help. Lost USB BlueTooth Dongle for Keyboard and Mouse I lost my USB bluetooth dongle (from HP) which I used for a wireless keyboard and mouse. They came together in a set when I bought my last HP computer.  Are the keyboard and mouse useless now? or will any bluetooth dongle allow them to work? If I can just buy a new one - any recommendations on a replacement (good price, and perhaps works with Windows and Ubuntu out-of-the-box?   Forgive me if this is an easy question. I'm just not that familiar with wireless mice/keyboards. What is a valid use case for an "execute only" file permission? I was reading up on chmod and its .  I saw that 1 is execute only.  What is a valid use case for an execute only permission?  To execute a file, one typically would want read and execute permission.  $ echo 'echo foo' &gt; say_foo $ chmod 100 ./say_foo $ ./say_foo bash: ./say_foo: Permission denied $ chmod 500 ./say_foo $ ./say_foo foo Is $\bar X$ a minimum variance unbiased estimator of $\theta$ in an exponential distribution? I proceeded by finding $\operatorname E(\bar X).$ I considered $\bar X$ as a constant and simply got the term itself. This should suggest that $\bar X$ is not an unbiased estimator of $\theta$. That's obvious too cuz it's a constant(from what I assumed). However, I'm also aware that $\mu = \theta$ so that's probably not right.  I have to demonstrate first that $\bar X$ is an unbiased estimator of $\mu$. Encopresis: how can we encourage our child to clean himself or ask for help immediately instead of ignoring the dirty underwear? Do images uploaded to imgur.com have any backup? This is a question that keeps bothering me: much of mathematics was created by extending rules to new domains e.g. negative numbers were created by consistently extending arithmetic beyond positive integers. However, with number bases it seems impossible to do this. Number bases are integers, but could they be rational numbers? I've had previous discussions about this, see . One problem can be seen with this example: in base 2.5, 0.22 is greater than one. That's not what we want! What, if anything, can be done about this?  EDIT: To put it another way - if every positional number is less than any digit to its left, why doesn't this apply to fractional base positional numbers? Text won't appear in interface? There is one problem, it seems that text won't appear on my program. The three images show the errors and also my laptop specs (I believe I just have very small amount of laptop power that makes Blender glitch).  Everything else works fine (zooming, panning, rotating, etc.) and the buttons are still there and do what they're supposed to do, but the text just won't appear.  Might anybody know how to fix this?        The drive update didn't help either. I know a way around it though, does anybody know a page which shows screenshots of more or less the buttons on blender How can I do this fast?  Sure I can do this:  static bool ByteArrayCompare(byte[] a1, byte[] a2) {     if (a1.Length != a2.Length)         return false;      for (int i=0; i&lt;a1.Length; i++)         if (a1[i]!=a2[i])             return false;      return true; }   But I'm looking for either a  function or some highly optimized proven way to do this.  java.util.Arrays.equals((sbyte[])(Array)a1, (sbyte[])(Array)a2);   works nicely, but it doesn't look like that would work for x64.  Note my super-fast answer . Help with proving that $\pi$ is irrational Can we add Markdown support for tables? Is system cleanup/optimization needed Does Ubuntu need regular cleanups like Windows. For example:   Cleaning the logs Temporary files Package cache Dependencies left over   I am not referring to web browsers only.  In case I never do a cleanup, will I have a system like new without my hard drive being full of temporary files, packages, etc.?  Will the performance degrade overtime if a cleanup is not done. Equivalent of String.format in jQuery