Regular expressions are a declarative language, mainly used for pattern matching within strings. Please include a tag specifying the programming language you are using, together with this tag.

learn more… | top users | synonyms

1
vote
1answer
26 views

SMS relay --> MySQL database

The main purpose of my program is to extract GPS information from text messages sent to several GSM modems send from various GPS tracking devices. The main flow of my program loops in three steps: ...
4
votes
1answer
38 views

Multiplying Lists

Challenge: Given 2 lists of positive integers. Write a program which multiplies corresponding elements in these lists Specifications: Your program should accept as its first argument a ...
0
votes
0answers
19 views

Matching characters in different languages [migrated]

Is this a right way to check for characters (both English and non English characters like umlauts in German and others)? ...
5
votes
3answers
130 views

Optimize huge text file search

I have several huge 100MB text files that I need to scan through to pick out certain frame numbers which relate to a specific log packet of interest. My plan was to scan for these frame numbers and ...
1
vote
2answers
40 views

Pulling thread data from Invision power board from an external java application

What I am planning on doing is pulling the first post of my news section, this was made for V bulletin and now I need to add it for IPb. ...
3
votes
3answers
104 views

SQLite insert code optimization

I just started working with SQLite in C# to test various features of an application. In building my first SQLite example I wanted to insert a large csv into a table (Person) with two columns, A and B. ...
12
votes
1answer
427 views

Capitalize the first character of all words (even when following a '-')

I got it working, all variations are displayed Sint-Anna as should be, but I wonder, is there a simpler way to this, since it looks very cluttered? ...
5
votes
1answer
78 views

Regex for matching a US phone number

I have written my first regex: ...
1
vote
1answer
58 views

An easier way to test a valid username

I have the following requirement for valid usernames: Only alphanumeric characters and - Must not start with a - I wrote this regex (on Rubular): ...
-3
votes
1answer
38 views

Regex for allowing only alphanumerical characters [closed]

This is my first regex: ^[a-zA-Z0-9][a-zA-Z0-9\/]*[\/]$ I want to: Only match alphanumeric at the beginning The last character must be a "/" Only alphanumeric ...
1
vote
2answers
42 views

Regex to Match Email address

I have the below regex to match email address with atleast one @ and one . ...
3
votes
1answer
47 views

Regex for curly quotes and apostrophes

After years of fear and procrastination I decided to learn regular expressions. This is the result: CoffeScript: ...
0
votes
0answers
30 views

Dynamically display relevant form elements

Here is a group of questions (hidden by default except the first one) with yes|no buttons ...
5
votes
3answers
95 views

Follow-up to Morse Code String

This is probably one of the many follow-ups coming. What I have edited: Added equals() and hashCode() Added ...
1
vote
0answers
43 views

HTML to plain text converter

Please, review the code below. Test class: ...
2
votes
1answer
50 views

HTML Compressor with regex

I would like to compress a Magento HTML page using some regex, and this is what I have written: ...
5
votes
3answers
54 views

Extract room sizes & room types from an estate description with regex

I'm trying to extract room types and sizes from a descriptive text utilizing the following scripts as an exercise. Any tips on being more pythonic would be amazing! The script is based off the help I ...
13
votes
2answers
146 views

I think I might be having a regex nightmare

I've been working on the Rubberduck (an add-in for the VBA Editor /"VBE"), specifically here the VBA.Parser namespace. Here's how I ended up implementing the syntax ...
4
votes
1answer
73 views

Parsing Lua 5.2 strings with patterns

I wrote some code to parse Lua 5.2 strings in Lua 5.1, using patterns. It's a bit too slow, but it works fine as far as I tested. ...
0
votes
2answers
47 views

Optimizing regex alternation, ability to view which choice matched?

So I've got a regular expression parsing tcp responses from a music daemon. In case responses pile up I've come up with an expression to separate full responses from the data, however I'd like to also ...
4
votes
2answers
43 views

Perl 6 oneliner to sum up all numbers in a text file

The task is to sum up scores mentioned in a text file. Scores are floating point numbers as defined by the regexp float immediately preceded by a * character to ...
2
votes
0answers
33 views

Replace while loop with sed

I have a script for school that mimics the cp command. Part of the assignment is to modify the script so that the while loop (that assigns stdin to the variable filelist) is instead done with sed. ...
5
votes
1answer
66 views

Regex matching keys in a Dictionary

I have extended this class http://wiki.unity3d.com/index.php/CSharpMessenger_Extended to accept strings containing wildcards as eventTypes, therefore I am able to ...
10
votes
1answer
54 views

Automatic report generation from BibTeX

I wrote the following code for the question I asked here. Are there any catastrophic mistakes? (actually it did not really work with perltex and I am in doubt about having syntax mistake(s)) Also, I ...
5
votes
3answers
56 views

Some simple Perl and Regex

Reads from a flat file of three columns, delimited by at least one tab character. Filters the three columns based on input; returns list of corresponding emails. Arguments passed like ...
6
votes
2answers
344 views

The Bucketizer Script

This code is written in a SSIS Script Component that basically accomplishes what I previously had as a T-SQL script, that was reviewed here. I need to split a 80 character string that contains 20 ...
2
votes
3answers
69 views

Searching text for a string

This is my current code: ...
4
votes
2answers
57 views

Substituting Hebrew letter variants

I have two functions that replace letters. In one function, I'm replacing a regular Hebrew letter with its final form, and the other function undoes this operation. (Consider it like ...
7
votes
2answers
341 views

replace() for translating color names

I have some code to translate some color names, and this is what I did, quick and dirty. But I'm guessing there might be some function to replace arrays with arrays maybe, like in PHP, where you can ...
2
votes
1answer
99 views

Removing stray brackets from in between shortcodes

I was wondering if someone could point me in the right direction for cleaning up this code. WordPress uses shortcodes in the form [shortcode] to add extended functionality to posts and pages. What ...
3
votes
2answers
84 views

Regex to select the last components of a file path

I have a regex sequence that will take the end of a file path and select it for me for example: ...
6
votes
4answers
94 views

Extraction of numbers from currency string

I have the following code; whereas currency and views are in reality many JSON objects from an SAP export, that I can not rely ...
4
votes
3answers
78 views

Regex to find addresses and phone numbers

I am trying to optimize my Java code where I am parsing an address field. Address fields have the format: ...
23
votes
4answers
3k views

Someone thinks poorly of my server log parser

I have just been informed that the following code written by me is extremely poor. I have absolutely no idea why. It is memory efficient, and looks clean to me. But still the feedback is very poor. I ...
3
votes
3answers
506 views

DateTime-like class implementation in modern C++

In modern C++, there is no class like datetime in the standard which can be used in the program. However, with additional of modules like ...
3
votes
1answer
29 views

Faults using mod_rewrite

I never really bothered using mod_rewrite to achieve SEO friendly names but I've always admired from a distance because I've never been good at regex. The below .htaccess file does work, but I'm ...
4
votes
1answer
114 views

Fast regex to extract strings before and after a time

I want to get text1 and text2 by splitting time format Text1 10:24:02 Text2 Of the ...
8
votes
2answers
100 views

Generating and calling code on the fly

Delegate This class module defines what I'm calling, in this context, a Delegate - here a function that can take a number of parameters, evaluate a result, and ...
8
votes
1answer
457 views

Email validation using JavaScript

I have a function where I validate emails via a regex. I was wondering if this is the best regex to use or if there's a better way of doing it. Also is there a ...
4
votes
1answer
115 views

CodeEval Sequence Transformation

I've been working on this challenge for a week: There are two sequences. The first sequence consists of digits "0" and "1", the second one consists of letters "A" and "B". The challenge is to ...
4
votes
1answer
101 views

Regular expressions - match only specified string length

I'm learning regex. Here I'm checking a string of type aA1 but want also to check it is only 3 characters long. Is there a better way of doing it please? ...
1
vote
1answer
34 views

Using Regexp to select the date from a string [closed]

I have a string with date details with time, but I would like to show the day information alone. For that, I use the regexp to select the date. Can anyone tell me the regexp, and if what is used is ...
2
votes
1answer
62 views

Regex-ing an array

I am new using regex expression. After much digging I came up with this code. I would like to know if this is the correct way. I want to search in Joomla for some html tags with specific class and ...
4
votes
1answer
83 views

Deserialize an email header into key-value pairs

I've created a function that will deserialize an email header into a list of key-value pairs. I've run numerous tests using MS Office Outlook 2010 and MS Office 14.0 Object Library, all of which were ...
2
votes
2answers
170 views

Phone Number Extracting using RegEx And HtmlAgilityPack

I've written this whole code to extract cell numbers from a website. It is extracting numbers perfectly but very slowly, and it's also hanging my Form while Extracting. ...
4
votes
1answer
56 views

Split a string of hostnames, expand from regex, return non-duplicated names in original order

I have the following function. It can be passed a candidate_string such as the following examples: "device1 device2" "device1" "device.*" "device.region" "device[123] Assume that target_list ...
11
votes
2answers
334 views

Markdown to HTML

...
6
votes
1answer
54 views

Expand hostnames from a string of hostnames and/or regex

This code will be passed a string which will contain one or more hostnames. A hostname can be dotted-decimal plain name (like my_host) FQDN or even partially ...
2
votes
2answers
38 views

Performance of RegExp vs Rune Loop

I was recently talking to someone about a function I wrote to mimic (very basically) the string interpolation function String.Format() found in the C# language. ...
3
votes
2answers
72 views

Align text (left, center, right) without additional packages

I wrote this short subroutine to left, center, right-align a multiline string. How can I make it better (shorter, prettier, optimized)? Can you offer some suggestions? ...