Skip to content
Advertisement

Tag: regex

Making first letter capital using regex like in ucwords

I need to convert a String value in to Upper case (First letter to upper in every word). This can be done in php by using ucwords() method. Ex : Thanks with hi5 Answer Undermentioned will work great in all your situation How to use :: Try defining this code n your super class ( Best code practice ) Now

Php Regex: how to match repeated patterns

given following text I need to capture columns values. I thought something about these lines: But unfortunately it captures only first column. Any suggestion? Thanks ` ====EDIT==== Just to be clear: i know that i could preg_match searching for d+ values or split the whole string in lines and run explode on the each line, but I’m interested in regex

Find and replace (part of) string in comment blocks with regex

I’m trying to find a certain string that can occur inside a comment block. That string can be a word, but it can also be part of a word. For instance, suppose I’m looking for the word “codex”, then this word should be replace with “bindex” but even when it’s part of a word, like “codexing”. This should be changed

Validate UK short (outward) postcode

I’m using this validator: From this link. But I want to be able to validate postcodes like ME20 and TN10 instead of a full blown ME20 4RN, TN0 4RN. This is the part of the postcode known as the ‘outward code’. Can someone help me out with the regex? Answer you can use my updated regex to solve you problem

PHP Regular Expression for Bengali Word/Sentence

I am developing a web application using PHP 5.3.x. Everything is working fine, but unable to solve an issue due to regular expression problem with Bengali Punctuation. Following is my code: Whether I pass Bengali word or not, it always returns false. In JavaEE application I used this Regular Expression But in PHP it not working! Anyways how do I

Custom Regular Expressions [closed]

It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago. How is it possible to use regex to separate into BCT343 format? I

Replacing text between two limts

I have been trying to get the text between two symbols to be replaced with preg_replace, but alas still not quite getting it right as I get a null output that is empty string, this is what I have so …

Email validation using regular expression in PHP

I am pretty much new with regular expression. I am developing a project in PHP and i need to validate email address. After searching in this site and google i found the following regular expression says it should work best. But when I use it I get error says, What is wrong with this code? Answer Use this instead of

Advertisement