Tagged Questions
2
votes
3answers
28 views
validation for 12 hours time with AM/PM using java script in PHP
I am trying to validate the time in
00:00 to 11:59 ends with AM OR PM
I was tring some regex,but not getting succesful to validate time.
My java script function is
function verifydata( incoming ) ...
1
vote
2answers
40 views
preg_replace for words containing space doesn't work
it's not working for words containing spaces, it works for single words
if possible changing the words from array to bold
the real code
$_POST['descricao'] = "parede hidrĂ¡ulica: teste de parede ...
0
votes
3answers
40 views
php regexp last match
Condition:
I have a peace of html code from wysiwig (Brief).
I need to inject readmore link to the last paragrpaph (p-tag)
public function injectReadMore($html){
if( $this->is_html($html) ...
0
votes
1answer
23 views
preg_match_all to return push empty data to resulting array when no match found
im trying to use preg_match_all on the following data
$data = " .........data
<p class='need'>
...........data
</p>
<p class='need'>
...........data
...
0
votes
4answers
38 views
php regex finding a string between two strings
I wanted to perform a regex in php. From the $str variable I want to select out common_name = Bangladesh . I wore my regex. The regex is not finding any match here. How can I fix this?
$str = "| ...
1
vote
1answer
44 views
regex replacing text for links not working as expected
So I want to replace "strings" for <a>"strings"</a> having an array with strings and another one with URLs. Everything worked like a charm at first, it replaces the first coincidence not ...
1
vote
0answers
43 views
Map a key to a value with placeholders
I have an array like this:
$arr = [
'a::b::c' => 'na::nb::nc',
'1' => 'one',
'helloWorld' => 'goodbye'
];
I want to map a key to a value with this array, so I wrote a function:
...
-1
votes
1answer
26 views
preg_replace to replace string for matching url [on hold]
function makeLinksInTheContent($html)
{
$html= preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2<a href=\"$3\" rel=\"nofollow\" >$3</a>", $html);
...
1
vote
1answer
36 views
Regex for finding url
<a href="http://newday.com/song.mp3">First Link</a>
<div id="right_song">
<div style="font-size:15px;"><b>Pitbull ft. Chris Brown - Pitbull feat. Chris Brown - ...
1
vote
1answer
28 views
error message automatically hide/disappear and stay on the input/form page after POST
sorry for my re-post with the same topic again. I have my form that include Phone Number and Email validation done with php, it works great, but when I click on submit button, the error message shown ...
0
votes
0answers
48 views
Regex or a function in php to help edit smokeping config file
I try to make a regex to catch some variables from config /etc/smokeping/config.d/Targets, and later to modify in config all of variables and autoreload the process.
Example text:
+ Internet
menu = ...
0
votes
3answers
50 views
remove fake comments from json file
since json dosn't support comments I need my own function to clean my comments
My comments are css style, like this
/*comment*/
i tryed the following
$json = preg_replace("/(\/\*.?\*\/)/", "", ...
0
votes
1answer
31 views
how to evalulate when reading and processing a html/php file
I am trying to create a template function:
function includeAndTemplate($file){
$json = '{"FIRST_NAME" : "First Name", "MIDDLE_NAME" : "Middle Name"}';
$template_vars = json_decode($json);
...
2
votes
4answers
41 views
sed regex with replace
Given a file:
<?
$dbo = mysql_fetch_assoc();
$dbo->employee_id;
$dbo->employee_name;
$dbo->dirt;
$dbo->dirt23;
$dbo->dirt_2_3;
?>
and using sed to find and replace:
sed ...
-1
votes
1answer
29 views
Regex expression assistance email content
I have an email, and in this email it has the following content:
Dear Someone,
Thanks for the reply.
Sincerely,
Someonelese
Quoting [email protected]:
right angle bracket||pipe originaltext
...