views:

186

answers:

8

Are Regular Expressions useful for a Web Designer (XHTML/CSS)? Can a web designer get any help if they learn regular expressions?

+5  A: 

Yes.

 

Shog9
______________Yes
Binoj Antony
+1  A: 

Among other things, it's great for validating input and cleansing html

Even if you don't use them directly, RegExes are a way of thinking about manipulating text that have proven very valuable to me over the years from the very first project I was paid money to write in PERL to things I do today in .NET

Chris Ballance
A: 

No.        

Brian Campbell
+1 of course not. Why would you need RegEx when you can use jQuery?
epochwolf
+6  A: 

Anyone who works with text files on a regular basis, which includes all programmers, can benefit from learning regular expressions. They make find-and-replace tasks much easier, and save you a lot of manual editing. Almost all text-editing programs support regular expression searches.

You won't be able to use them in your code, if all you're doing is HTML and CSS. But if you start to use JavaScript, you'll find them useful for things like testing the value of input fields.

JW
A: 

CSS has partial support for regular expressions, so they might be of some use in that area.

Other than that, only if you code Javascript.

Alix Axel
+1  A: 

Regular expressions are not part of (X)HTML or CSS, but they are part of the tools you will probably use with them: Javascript, XSLT, and any server scripts.

The key is to remember that, because of the difficulty in parsing a language with quoted strings and SGML-style tags, that regex shouldn't be used to parse (X)HTML except as a last resort. Tokenizers exist so you don't have to do that particular hard work. You would find most regular expressions in use for checking and sanitizing input.

In short: yes, but always use the best tool for the job.

Anonymous
A: 

There are languages and protocols you use when creating web artifacts (pages, scripts, styles, etc.) and there are tools you use to manipulate those artifacts (editors, utilities, interpreters, etc.).

Regular expressions would belong to latter set and they belong to more advanced specter of it (based on the fact that average web designer is likely to have no clue). But any computer literate person would benefit from learning and using regular expressions - not just web designers.

Anything that makes you stand out (in positive way of course) in comparison to the crowd will benefit you - so go ahead and learn regex - you won't regret.

grigory
+1  A: 

Can a web designer get any help if they learn regular expressions?

If you're asking for some resources to help you with regular expressions, I find the MDC page on Regular Expressions and the Regular Expression Cheat Sheet quite useful references, and the Regular Expression Tester handy for testing regular expressions.

Steve

Steve Harrison