» Home » regExp » Page 1
Incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) on Heroku
Category : Programming Languages

I have a Rails application where I use regex-based rules to categorize transactions. In my seeds.rb, I create some categories and rules, then import transactions from a CSV file (also utf8-encoded) and allow them to be categorized. This process works fine on my development machine, but when I run it on Heroku, I get:


incompatible encoding regexp match (ASCII-8BIT rege


View Replies


emacs regexp-builder doesn't work in replace-regexp
Category : Programming Languages

I have an emacs buffer containing the text


a1b2c3

using the regexp-builder, i create the regexp


"b(2)"

and can see the match highlighting (b2, with the 2 in a different colour).


however, when i paste the expression into replace-regexp, i get 0 matches. both with and without the quotes. to get a matc


View Replies


best REGEXP friendly Text Editors + most powerful REGEXP syntax?
Category : Programming Languages

I am fluent with Microsoft Visual 2005 regular expressions and they are a big time saver.


I seem to learn them best by having a vaguely organized cheat sheet thrown at me, at which point I read just a little and play with them until I understand what's going on. That learning approach has worked well for me, for now.


I would really like to take this to the next level tho


View Replies


Rake assets:precompile error: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
Category : Programming Languages

WHen running rake assets:precompile I get the following error:


Caught Encoding::CompatibilityError at '["ok","function View': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
(in /Users/jethro/Dropbox/Rails/ol2/app/assets/javascripts/application.js)

I had not encountered this problem before pulling a push from Gi


View Replies


Is there a performance gain if you don't use new in front of RegExp() vs. simply RegExp()?
Category : Web Design

I want to replace all occurrences of a substring in a string.
Will there be any difference between the following two examples?


var str='A horse walks into a bar and the bartender asks "Hey, why the long face?".';
str.replace(new RegExp('bar','g'),'restaurant');
// versus
str.replace(RegExp('bar','g'),'restaurant');

Note:
This is a simplif


View Replies


regexp in bash (downloading output form regexp)
Category : Programming Languages

I have got a file that look like:


<a href="some-adress">some-txt</a>
<a href="some-adress">some-txt</a>
<a href="some-adress">some-txt</a>
...

I need to download all files that are as "some-adress", how can I do that using only bash?


View Replies


Inconsistent behavior with RegExp Object in RegExp.match
Category : Web Design

I have detect a strange behavior in regexps created with the RegExp object:


With this code:


var exp1 = /./;
var exp2 = new RegExp('.');

var test1 = exp1.test('large
text..etc.');
var test2 = exp2.test('large
text..etc.');

var match1 = 'large
text..etc.'.match(exp1);
var match2 = 'large
text..etc.'.match(ex

View Replies


regexp that selects only the capital letter from another regexp
Category : Web Design

I have this type of text:


!D este caro
1 C este descgiderea
C1 este alta deschidere
Deschiderea de 1C este cu
2C
2D
3 D
1NT
2D
123456P

This easy regexp:


/([0-9][CDHS])/g

selects "1C","2C","2D","2D" (a digit immediately followed by [CDHS], anywhere in the text) .


What I want is to sel


View Replies


Is it possible to simulate string.match with a regexp.exec loop when the regexp matches the empty string?
Category : Web Design

It is common knowledge that the exec method from RegExps can get used to find all matches in a string. However, I just found out that if the regexp matches the empty string this loop can get stuck forever


var s = '1234'
var r = /()/g;
var m;
var i = 0;
while( (m = r.exec(s)) ){
console.log(i, m[0]);
if(++i >= 50){ console.log("infinite loop!

View Replies


regarding regexp in PHP
Category : PHP

I'm decent at PHP(far from an expert) but a pure novice when it comes to regexp and scraping. I wanted to do a little bit of scraping to help with some research and to educate myself, but I've ran into a problem. I want to extract prize from the following part of a page:


<th valign="top"> Prize pool:
</th>
<td> $75,000
</td></tr>

View Replies

TAGS : regarding regexp

Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .