XXX-XXX-XXXX   XXXXXXXXXX         I want to use a regular expression of the format. I tried as shown   below, and an error occurs. How do I fix it?      sample var regExp = / ^ 01 ([0 | 1 | 6 | 7 | 8 | 9]?) - ([0-9] {3}) - ([0-9] {4}) $ /??; sample var regExp = / ^ 01 ([0 | 1 | 6 | 7 | 8 | 9]?) ([0-9] {3}) ([0-9] {4}) $ /??;
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.
Php - regular expression to check if the string has chinese chars How do I enable Remote Desktop connection on Xubuntu 11.10? Coincidence, purposeful definition, or something else in formulas for energy In the small amount of physics that I have learned thus far, there seems to be a (possibly superficial pattern) that I have been wondering about.  The formula for the kinetic energy of a moving particle is $\frac{1}{2}mv^2$.  The formula for kinetic rotational energy is $\frac{1}{2}I\omega^2$.  The formula for energy stored in a capacitor is $\frac{1}{2}C \Delta V^2$.  The formula for energy delivered to an inductor is $\frac{1}{2}LI^2$.  Finally, everyone is aware of Einstein's famous formula $e=mc^2$.  I realize there are other energy formulas (gravitational potential energy, for example) that do not take this form, but is there some underlying reason why the formulas above take a similar form? Is it a coincidence? Or is there a motivation for physicists and textbook authors to present these formulas the way they do? Mean or sum of gradients for weight updates in SGD How can I reuse existing materials, objects, etc from an existing .blend? I have created several designs for a particular project and they are related, but I don't want to have to keep recreating any similar elements, such as shared materials or textures.  How can I use the existing data in a new Blender file? Where can I find good literature for beginners? I am trying to find some database tutorials,books and similar, since I have started this course in college, and received some material, but it is really hard to manage through all the info on the net. I searched through the questions on the site but didn't find any. Thankfull for all your input. the method getApplicationContext() is undefined How to preserve non-ASCII characters in ogr2ogr import? Coordinate-Free Definition of Trace. Safari Extension to Manage Tabs? Excel multiple FIND formula I am no expert with excel so any help is appreciated!   I am trying to make one cell do multiple searches within another.  I know that to search one cell for a specific word you would use  =FIND(Blue,C2)   But I need to find multiple different words in one cell. Heres an example of what im trying to do:    I need to show all the allergens in the ingredients cell eg peanuts, gluten, milk, sesame seeds etc   How do I get the result to list all the allergens?   I know that I can do a single find function in separate cells and then concatenate them, but there must be a more simple way?  Thanks Square roots -- positive and negative Publish and/or subscribe to Platform Events between separate Orgs? Looking for a single word for 'blind worship' Is there a single word for 'blind worship' as in worshiping an actor blindly notwithstanding the bad performance? How to unit test an object with database queries I've heard that unit testing is "totally awesome", "really cool" and "all manner of good things" but 70% or more of my files involve database access (some read and some write) and I'm not sure how to write a unit test for these files.  I'm using PHP and Python but I think it's a question that applies to most/all languages that use database access. How to prevent nginx redirecting from HTTPS to HTTP on AWS? I have a website served by nginx behind an AWS ELB Load Balancer. Only HTTPS is enabled on the load balancer.  Requesting individual files, or directories with a trailing slash, work fine. However, requesting directories without a trailing slash don't work.  The reason is, when I request the directory without the trailing slash, nginx does a redirect to the path with the trailing slash (that's OK), but it also changes from HTTPS to HTTP. The load balancer is configured to only allow HTTPS, so that doesn't work (timeout).  On the nginx logfile, I can see that the request reaches nginx, and that it's nginx that responds with the 301 Permanent Redirect (so it's not e.g. a problem with the load balancer setup).  10.100.10.15 - - [24/Nov/2017:15:41:08 +0000] "GET /admin HTTP/1.1" 301 178 "-" "Wget/1.18 (darwin16.0.0)"   When I request the URL via curl I see the redirect:  $ curl -v https://example.com/admin *   Trying 1.2.3.4... * TCP_NODELAY set * Connected to example.com (1.2.3.4) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: example.com * Server certificate: Amazon * Server certificate: Amazon Root CA 1 * Server certificate: Starfield Services Root Certificate Authority - G2 &gt; GET /admin HTTP/1.1 &gt; Host: example.com &gt; User-Agent: curl/7.54.0 &gt; Accept: */* &gt;  &lt; HTTP/1.1 301 Moved Permanently &lt; Date: Mon, 27 Nov 2017 09:19:05 GMT &lt; Content-Type: text/html &lt; Content-Length: 178 &lt; Connection: keep-alive &lt; Server: nginx &lt; Location: http://example.com/admin/ &lt; X-UA-Compatible: IE=Edge &lt;  &lt;html&gt; &lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt; &lt;body bgcolor="white"&gt; &lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt; &lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt; &lt;/body&gt; &lt;/html&gt; * Connection #0 to host example.com left intact   My nginx config file is just   server {     root /var/www; }   The /etc/nginx/nginx.conf is .  I have tried server_name_in_redirect off but it did not make any difference.  I would like to avoid putting the hostname in the config file, because this is packed into a Docker image which is then deployed on different hosts (QA, Prod, etc.).  I would like nginx to do this redirect, but stay on HTTPS. What can I do? I have 238gb of timelapse photos which was taken over a period of twenty days and all the photos are split up into 20 folders. I would like to put this together into a timelapse, I tried using Premiere Pro but that is taking very very long, any tips on putting it together fast btw Im on a Mac, thanks. How to get full query text from performance_schema.threads? According to : Access to the threads table does not require a mutex  and has minimal impact on server  performance. The other sources have negative performance consequences because they require a mutex.   So yes, I want to use threads table to examine running queries. The trouble is, the PROCESSLIST_INFO column does not contain the full query. It just contains a truncated version of the query. There is a flag viz performance_schema_max_sql_text_length which controls how many bytes are allocated for the SQL query. But it seems to affect the events_statements_history_long table. There is no change in the thread table output. There is also the events_statement_current table. But it is not clear if accessing that table affects performance or not. Bad match with a gaming group, how to leave? I have sometimes joined groups whose play style didn't work for me. At some point it became clear that as much as I wanted to enjoy the game I couldn't. And I was probably undermining the fun at the table for others too.  What is the best way to leave the group? Quietly or with a few explanations? Announce it in person or by email/phone/forum? Is it OK to recruit players from the group for another game? Show that $F\subset Y$ is closed in $Y$ iff $F=Y\;\cap\;H$ where $H\subset X$ is closed in $X$. I have the following problem:      Let $(X,\tau)$ be a topological space and $(Y,\tau_y)$ be its    subspace, that is $Y\subset X$ and $\tau_y=\{\;A\;\cap\;Y\mid  A\in\tau\;\}$. Let also $F\subset Y$ and $H\subset X$, where $H$ is    closed in $X$. Show that $F=Y\;\cap\;H$ if and only if $F$ is closed   in $Y$.   I solved this problem by assuming that if $F$ is closed then $F=Y\;\cap\;H$, where $H$ is closed in $X$, but I got stuck proving this in the other direction, that is showing that if $F=Y\;\cap\;H$ then $F$ is closed in $Y$.  I tried to do something like this:   Assumption: $F=Y\;\cap\;H$, where $H$ is closed in $X$. If $H$ is closed in $X$ then $X\;\setminus\;H$ is open in $X$ and then $X\;\setminus\;H \in \tau$ which means that $B = (X\;\setminus\;H)\;\cap\;Y\in \tau_y$.  How should I proceed now? Should I investigate the set $B$ now more or what?