The tag has no wiki summary.

learn more… | top users | synonyms (1)

-2
votes
1answer
85 views

What is the right way to parse HTML? [on hold]

I've heard, that parsing HTML using the Cthulhu way is not very good. But what are the right ways to parse HTML? Or is it possible to parse it at all?
-3
votes
1answer
38 views

Text field Form [closed]

I have 2 forms that have text input fields. One is written in JavaScript and the other in ASP NET. I would like to prevent a single symbol, the dollar or string "$" symbol from being entered into the ...
0
votes
0answers
8 views

Regular expression assistance [migrated]

I have a client's site that keeps getting hacked with XSS injections somehow. These XSS attacks are without fail in the banners section, and the banner ads need to have <script> tags to ...
14
votes
7answers
1k views

Should I refactor large functions that mostly consist of one regex? [closed]

I just wrote a function that spans approximately 100 lines. Hearing that, you are probably tempted to tell me about single responsibilities and urge me to refactor. This is my gut instinct as well, ...
2
votes
2answers
81 views

Regular Expressions and Language Generators

I have few CS textbooks with me which discuss languages, well actually 2 plus old course notes supplied a few years ago. I have been searching the web too any only seem to come up with vague responses ...
0
votes
1answer
44 views

Nomenclature for wildcard vs regex expressions [closed]

When I see the term pattern in a description of syntax I infer a regular expression is being specified. Is there a separate term that specifies a wildcard expression? ^foo.*(bar|baz){3} <-- ...
94
votes
17answers
12k views

What is meant by “Now you have two problems”?

There is a popular quote by Jamie Zawinski: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. How is this quote supposed to ...
4
votes
1answer
303 views

Are there any implementations of deterministic regular expressions? [on hold]

The question itself is already in the title, so here I will just provide additional details. I call a regular expression "deterministic", if, after converting the regular expression into a ...
0
votes
2answers
154 views

Multi regex matching — what to do to optimize it?

I have multiple regexes matching an input in greedy-first mode. All regexes are already compiled and I don't see what I can do more to speed-up things. I mean using tools coming with .Net framework. ...
3
votes
1answer
126 views

Object oriented parser model review

First time I make use of Code Review. At the moment I'm creating an Android application and the company I'm developing it for, has a specific file format that can be used to give text based data ...
-1
votes
1answer
118 views

Building a regex builder [closed]

I am a beginner in programming in general and web development in particular. I am especially bad at regular expressions. Recently I was involved in building a couple of cPanel plugins(Perl-CGI) and ...
2
votes
1answer
461 views

Java regex patterns - compile time constants or instance members?

Currently, I have a couple of singleton objects where I'm doing matching on regular expressions, and my Patterns are defined like so: class Foobar { private final Pattern firstPattern = ...
2
votes
1answer
259 views

Optimized Special Character Escaper vs Matcher/Pattern

I need to escape special characters which are sent to apache lucent. Since the code will run on a production server I want the code to be the fastest possible. I've seen multiple ways to do it: ...
2
votes
1answer
102 views

How does the ? make a quantifier lazy in regex [closed]

I've been looking into regex lately and figured that the ? operator makes the *,+, or ? lazy. My question is how does it do that? Is it that *? for example is a special operator, or does the ? have ...
1
vote
1answer
197 views

pcre case insensitivity: handle escape sequences as raw bytes?

Consider the following regex (no unicode): Example:\x04\x05\x41 Suppose you search this regex case-insensitively. Would you expect it to search the final \x41 in case-sensitive manner? People whom ...
0
votes
1answer
502 views

Why nginx's http parser doesnt use regular expressions?

I see the http parser written by Igor Sysoev for nginx does not use regular expressions https://github.com/joyent/http-parser What could be the main reason for such design decision? I guess I could ...
50
votes
10answers
3k views

Readable regular expressions without losing their power?

Many programmers know the joy of whipping up a quick regular expression, these days often with help of some web service, or more traditionally at interactive prompt, or perhaps writing a small script ...
2
votes
3answers
281 views

Domain-specific language for text search/processing?

I work for an organization that does a lot of work with government data. We have a couple of different projects where we've abstracted out common text search/manipulation operations into reusable ...
2
votes
1answer
283 views

How to choose a proper parser generator for PHP

Some programmers avoid regexes in some situations (see this popular @nickf comment), perhaps using a parsing framework such as Lex/Yacc. Others prefer to stay within PHP, perhaps using regular ...
5
votes
3answers
289 views

Constructing a Finite State Automaton

I have an exam question that I am unsure of the answer. The question is: In organisation X valid user names have the following structure. The user name can be either the employee’s name followed ...
3
votes
1answer
580 views

Constructing a Deterministic Finite State Automaton for a given Regex

I have a couple of exam questions for my compilers class and wanted to check if my solutions are correct. The first question is: Consider a language in which numbers start with an optional minus ...
-1
votes
2answers
184 views

Can non-IT people learn and take advantage of regular expressions? [closed]

Often times, not-IT people has to deal with massive text data, clean it, filter it, modify it. Often times normal office tools like Excel lack the tools to make complex search and replace operations ...
10
votes
5answers
3k views

Can the csv format be defined by a regex?

A colleague and I have recently argued over whether a pure regex is capable of fully encapsulating the csv format, such that it is capable of parsing all files with any given escape char, quote char, ...
2
votes
1answer
82 views

String patterns that can be used to filter and group files

One of our application filters files in certain directory, extract some data from it and export a document from the extracted data. The algorithm for extracting the data depends on the file, and so ...
20
votes
3answers
2k views

Are regular expressions a programming language?

In the academic sense, do regular expressions qualify as a programming language? The motivation for my curiosity is an SO question I just looked at which asked "can regex do X?" and it made me wonder ...
0
votes
2answers
180 views

How should a website validate a users mailing address?

This is for a site that relies on shipping items via UPS or FedEx. I know there is software out there that does it (http://en.wikipedia.org/wiki/Coding_Accuracy_Support_System), but if you are trying ...
2
votes
2answers
118 views

What is the best strategy for transforming unicode strings into filenames?

I have a bunch (thousands) of resources in an RDF/XML file. I am writing a certain subset of the resources to files -- one file for each, and I'm using the resource's title property as the file name. ...
5
votes
2answers
290 views

Python flavor of regular expressions - related to which?

So my copy of the classic book, Mastering Regular Expressions, just arrived, and I'm scanning through it. The cover (third edition) says, "for Perl, PHP, Java, .NET, Ruby, and More!" Well, it does ...
4
votes
2answers
292 views

Why does Java define homogeneous methods in Matcher and Pattern classes

I wonder why java defines homogeneous methods in two distinct classes: java.util.regex.Pattern and java.util.regex.Matcher. For example split method defined in Pattern class and replaceAll method ...
7
votes
5answers
732 views

Lexical Analysis without regular expressions

I've been looking at a few lexers in various higher level langauges (Python, PHP, Javascript among others) and they all seem to use regular expressions in one form or another. While I'm sure regex's ...
64
votes
23answers
11k views

Is it a must for every programmer to learn regular expressions?

I am new to programming, and at an interview I got a question on regular expressions; needless to say I couldn't answer. So I was wondering whether I should learn regular expression? Is it a must for ...
11
votes
7answers
4k views

How do regular expressions actually work?

Say you have a document with an essay written. You want to parse this essay to only select certain words. Cool. Is using a regular expression faster than parsing the file line by line and word by ...
2
votes
4answers
315 views

Maintaining Regex in a .net application

I am sure everybody has had his/her share of regex woes. We have a big application with around 30 developers working on a mvc3 web application , and the two fold regex validations (front-end and ...
13
votes
10answers
906 views

Inspiring problems to show off the importance of regular expressions? [closed]

I am planning to give a presentation/demonstration on regular expressions at work to encourage young developers to add this powerful and important tool in their toolbox. Just teaching syntax doesn't ...
26
votes
4answers
3k views

When you should NOT use Regular Expressions?

Regular expressions are powerful tool in programmer's arsenal, but - there are some cases when they are not a best choice, or even outright harmful. Simple example #1 is parsing HTML with regexp - a ...
78
votes
18answers
4k views

How do you learn Regular Expressions?

I'm not asking where to learn. I've found lots of good resources online, and books etc. But how the heck do I tackle them. Where is the start of it, the end? When does the regexp processor advance on ...
1
vote
2answers
270 views

Documentation often ommits to specify which flavour of regular expression to use, so is there a default flavour that we should all be familiar with?

Often I come across documentation that says "use a regular expression here" I have to spend quite some time digging around trying to work out which regular expression format they are expecting. As ...
13
votes
7answers
680 views

What is more standard shortening for “regular expression”, “regex” or “regexp”? [closed]

I want to know what is more standard way to call regular expression in short way. I have seen both, regex and regexp. Google says regex has almost 2 as much hits that regexp, but it depends on way I ...
4
votes
2answers
733 views

Using lookahead assertions in regular expressions

I use regular expressions on a daily basis, as my daily work is 90% in Perl (legacy codebase, but that's a different issue). Despite this, I still find lookahead and lookbehind to be terribly ...
7
votes
10answers
996 views

A better way of doing Regex? [duplicate]

I really dislike regular expressions, each time I come back to it I seem to have to relearn it. It's also incredibly hard to maintain, modify and at a glance understand what it is doing. Has anyone ...
12
votes
6answers
472 views

What can / should be done with regular expressions?

I've recently learnt regular expressions and I love writing / using them. I'm looking for ideas and more opportunities to use them, however I don't want to overuse them as an all purpose tool, as ...
3
votes
1answer
702 views

can a regex search engine for the web be done and if so, how?

I think it would be a great idea if we had a regular expression search engine, but can it be done? It seems impossible since there's no feasible way of indexing such a huge amount of data properly and ...
8
votes
6answers
801 views

Resources for Learning Regular Expressions [closed]

What are the best resources you've found for learning regular expressions?
1
vote
2answers
291 views

Regexp or custom parsing algo?

I was trying to parse a java properties file to avoid some Properties loading pitfalls (non ordering, loss of comments). (Property are of the form 'key = value' where the value can span on multiple ...
36
votes
0answers
4k views

What does the Jamie Zawinski's quotation about regular expressions mean? [duplicate]

In a message to comp.emacs.xemacs, Jamie Zawinski once said: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. I've always ...
73
votes
25answers
12k views

How far should one take e-mail address validation?

I'm wondering how far people should take the validation of e-mail address. My field is primarily web-development, but this applies anywhere. I've seen a few approaches: simply checking if there is ...