Regular expressions are a declarative language, mainly used for pattern matching within strings.

learn more… | top users | synonyms

0
votes
1answer
20 views

Add an attribute to a specific tag in text body of page

I would like to add an attribute to a specific tag in the text body of a page. I was thinking in this direction: add MYTHEME_preprocess_field(&$variables) to template.php apply regular ...
0
votes
1answer
32 views

How to apply Simple Regex Filter to forum signature?

I'd like Simple Regex Filter to be applied to Signatures for Forums to close the loophole for human post spammers on my drupal 7 forum. How to achieve it?
0
votes
0answers
164 views

validate field using regular expression in Field validation module

I have added a text field in a content type. I'm looking to validate that field by adding a Rule using "Field Validation" module. I found few options in this module like regular expression ( Regular ...
0
votes
2answers
1k views

How to get a list of all javascript files in a directory

Is it possible to get a list of all the javascript files in the libraries directory? So far I have tried using files_scan directory but it's not returning anything: $dir = base_path() . ...
0
votes
1answer
70 views

Change in core drupal module regex security risk

As interim solution to an issue in javascript I changed in Core Drupal user.module file line, to disallow single quotation mark: if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) { to if ...
2
votes
1answer
185 views

How to redirect all images in the files folder to a default file?

Because we work with DTAP environments, our developers work on their own laptops. To get a good view of the live environment, we copy the PROD database and the files to our own laptop. However, this ...
0
votes
1answer
240 views

regex works in PHP fiddle but not in Drupal

I am having a problem getting some regex to work in Drupal. The below regex works fine: <?php $test = "1111~~test1<>2222~~test2<>3333~~test3<>44444~~test4<>11112~~test5"; ...
1
vote
1answer
135 views

Regex Jquery in Drupal 7 not working [closed]

(I have posted this on Stack Exchange as well) I have a Drupal 7 page on which I need to remove text bracketed by "Keywords:" and "Description:", there are a number of text blocks all with the class ...
2
votes
1answer
281 views

Text comparison rules on node:body:value with input filters

My text comparison rule works like a charm if the user selects 'Plain text'. If they use 'Filtered HTML' it doesn't find a match even though the pattern does exist in the raw and filtered versions of ...
0
votes
1answer
102 views

How do you replace text surrounded by a custom delimeter with <span> around it?

Overview I want to have action asterisks in my posts. Basically, asterisks surrounding certain words. Examples: *gasp* or *giggle* Simple enough. Now I could type that exactly into the editor but it ...
0
votes
1answer
897 views

Use Regex to insert jQuery querystring before a url anchor

On my page I have some content links that start with '/example/'. I'm using jquery to add a querystring to these links, which is the parent of the currently viewed node. So, the code looks like ...
1
vote
4answers
559 views

Email validation '+' not accepting

I have written email validation as follow. if($email != ''){ if (!ereg("^[_a-zA-Z0-9]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,3})$",$email)) { ...