Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I know there are tons of questions about regex string format, but I am very new to this and I haven't been able to do it myself. How can I use regex to match a string with the following format?
xx_x_a.zip
where x is a number and a is a letter. Example:
33_2_f.zip
It must not match:
33_2_f_abc.zip
The format must always be like 2digits+_+1digit+_+1letter+.zip
Simplest way:
/^[0-9]{2}_[0-9]_[a-z]\.zip$/
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a string of the form
<something>_string_t_<digits>
How can I extract just the <digits> portion in PHP ? I need to detect the string_t first and then pull out the digits.
You want something like this:
$captures;
preg_match('/string_t_(\d+)/', $string, $captures);
do_something($captures[1]);
$captures[1] will contain <digits> (assuming <digits> is composed entirely of numbers - if it's not, use the more general (.+) in place of (\d+)).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need to convert amount into words for example total = 5600 into five thousand six hundred only in yii2
In case of using Yii2 you can do it as simple as the following:
see this Doc reference.
You have to use formatter it will then format it according to your app's language
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hello,
I'm making an application in which I have the points (p0,p1), and need to find the points for perpendicular segments at the end of (p0,p1)... namely, (A,B) and (C,D), which are of length $len.
There is a similar question to this one in this post, but unfortunately I am not sure about how to interpret the answer...
I'm using php for this project, but the solution can be in any language as I can translate it later.
(A-E)/(l/2) = (p1-F)/L
and so on...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i want to allow only characters X,N,-,(Space) to string which user inputs.
Ex : XXXX-NNNNN XXXXXX-NNNN is valid string but
Ex XXXx-1NNN XXXX-NNNN is not valid string.
I have found so many regexp for that but didn't find helpful solution
I want this solution in zend form
Try this:
preg_match("/^[XN -]+$/", $string);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Please any one help me. As I am a noobe in PHP coding. Is there any built in function to trim letters in PHP??
Lookup substr()
http://us2.php.net/substr
Should do the trick
$var = 'teststring1234567890';
substr($var, 0, -10);
returns 'teststring'