Tagged Questions
0
votes
0answers
26 views
Making folder names from URL php
I have a system which will store certain files for various websites.
Some websites are shown as basic:
www . myrandomsite . com
www . yetanothersite . com /sublevel/
http: somefunky.sub . org
...
0
votes
2answers
33 views
PHP and mysql Ignoring the special chracters present in the database
a little help on this one, here are its details
[Products]
id int
name text
category
color
Problem is the values of the color field, sample values are:
GOLDRED
GOLD-RED
GOLD/RED
BLUE/GREEN-RED
...
2
votes
1answer
23 views
Preg Match Between Curly Braces - preg_match
Example Subject: {this}{is}a{my} {example}{{subject}}
To return:
array(
[1] => 'this'
[2] => 'is'
[3] => 'my'
[4] => 'example'
[5] => 'subject'
This is common in php templating ...
0
votes
3answers
25 views
Best Practice for validating field data, before or after insert into database, on bulk insert?
Well I will explain what I'm doing.
I need to validate files with restricted data, that comes with more than 100k rows each with 120 fields, each field has his own validation according to defined ...
1
vote
2answers
50 views
Parsing Json Data in html tag
I need to extract a json object inside a web page's script. This is a part of the web page:
<html>
<script>
.....
</script>
<script type=\"text/javascript\">
...
-2
votes
3answers
28 views
Regular expression to match multiple strings with AND operator
I'm developing an HTML parser. Specifically, I'm working on a module which parses PHP errors from the returned HTML. Here's an example:
PHP Fatal error: Undefined class constant ...
-4
votes
1answer
23 views
HTML Doc Type and Char set by Regular expression
I'm working on a project at which it is needed to get doctype and char-set.
The fact is I get it by another way. But it is so difficult to get the doctype and char-set by regular expression as this ...
2
votes
1answer
20 views
How to use regex in php xpath query ($xpath->query)?
I would like to search links that contain "click" or "click here" text as anchor text.
If it matches then it should return href values.
Can someone tell me how to use regex here?
1
vote
2answers
32 views
preg_replace using pattern as index of replacement data array
I would like to know if there is a simple way to use the matched pattern in a preg_replace as an index for the replacement value array.
e.g.
preg_replace("/\{[a-z_]*\}/i", "{$data_array[\1]}", ...
2
votes
2answers
67 views
PHP separate even and odd values from an array
I'm using the below code to separate odd and even and store it in different variable. When there are only 2 value available then it works fine but when the number value increases then it doesn't. I ...
0
votes
5answers
55 views
How to get the value using Regex? [duplicate]
Hello I have a problem with my Regex code I use to get a value out of a HTML-tag using PHP. I have the following strings possible:
<span class="down last_position">xyz</span>
<span ...
0
votes
1answer
55 views
\n (New Line) is replacing whole string when I use preg_replace function
When I try
$stg = preg_replace("/<PREPNAME>.*<\/PREP_ZIP>/s","",$stg);
It properly work and it replace the text written in that function. And I get $stg is stripped and I get remaining ...
-1
votes
1answer
26 views
PHP Regular Expression Help: A quick way to extract the 2 from “page/2/” [closed]
Regular expressions - my current Achilles heal.
I just need a way to take the string "page/2/" and extract the number, and only the number. It will always take that format.
So could be page/2/ to ...
0
votes
5answers
56 views
Regex in PHP not working
My regex is:
$regex = '/(?<=Α: )(([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4}))/';
My content among others is:
Q: Email Address
A: [email protected]
Rad Software Regular Expression Designer says ...
-2
votes
1answer
32 views
php regular expression: how to correctly escape characters?
How to write preg_match, to match string *My* ?
This doesn't work:
$ptn = "/\*(.*)\*/";
$str = "*My*";
preg_match($ptn, $str, $matches);
print_r($matches);
because it outputs:
Array
(
[0] ...