Questions tagged [rubular]

A Ruby-based regular expression editor and tester.

A Powerful and most efficient Domain for testing Regular Expressions.

Website: http://rubular.com/

66 questions
0
votes
2 answers

How can I capture certain data using regex if it is dependent on another field?

I need help in writing regex for the below mentioned log: URLReputation: Risk unknown, URL: http://facebook.com I wrote a regex like below: URLReputation\:\s*(.*?),\s*URL\:\s*(.*) Here everything is working. But in case URL isn't there, the…
Mitesh Agrawal
  • 67
  • 3
  • 12
0
votes
2 answers

What can be the ruby regex for capturing specific value for given string?

I have a string like below : "[a06aad57-5671-482e-dbdd81dc39b1] Parameters: {\"ToCountry\"=>\"US\", \"ToState\"=>\"AL\", \"SmsMessageSid\"=>\"SMa1a9e32a7503f7342b7065d77174d\"}" I would like to capture only value of 'Parameters:' as below and…
roarfromror
  • 276
  • 1
  • 2
  • 11
0
votes
2 answers

Removing sensitive informations from the logs using regex

In my Ruby app I have the following regex that helps me with removing sensitive informations from logs: /(\\"|")secure[^:]+:\s*\1.*?\1/ It works when in logs are the following information: {"secure_data": "Test"} but when instead of string I have…
Mateusz Urbański
  • 7,352
  • 15
  • 68
  • 133
0
votes
2 answers

Regex - Matching in Rubular bu not in Ruby

Given text like: body = yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada yada < via mobile device > Yada Yada…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
0
votes
0 answers

Finding URL Instances Using Regex (Rubular)

I'm finding it really difficult to create a regex (rubular) syntax that I can use with our crawler to pull all the URLs that end with the word 'download'. Could you please help? Thanks so much! Here are the URLs to…
Iam_Amjath
  • 113
  • 1
  • 8
0
votes
3 answers

REGEX - Matching again multiple lines

Given text like: XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX.XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX.XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX. XXXXXXX.…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
0
votes
0 answers

How to use regex to match for number and string?

My variable column could either be a string or a number/float. I need to use my regex to catch both 20000 and "20000". Right now my regex is /^#{column}$/i which only catches the string "20000". In addition to this, I need it to stay case…
brandoncodes
  • 123
  • 1
  • 12
0
votes
1 answer

Rails understand regex differently then rubular

I wanted to do a simple regex-based email validation: class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value =~ /\A([\S]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i record.errors[attribute] <<…
user6052428
0
votes
0 answers

Regular Expression Interval Quantifier

Here is my Regular Expression: (?i)(test){1,3} Here are the strings I am using to test: test test test test I am using rubular.com to test. My interpretation of my Regular Expression is case insensitive, search for the word test without…
0
votes
1 answer

Why am I not able to match multiple lines with this regex on rubular?

I'm working with the following regex (taken from the devise.rb file that devise generates): \A[^@\s]+@[^@\s]+\z Usually, when I'm learning about a regex I use rubular. For example, if I wanted to learn about the regex /.a./, I would set up my…
mbigras
  • 7,664
  • 11
  • 50
  • 111
0
votes
1 answer

Rails Regex Match Group Overwriting itself

I am trying to match this string: NFPA 101 19.7.2.2 and am using this regex: (NFPA) (\w+)(?: ?(?:([^.]+)\.?)+)? This seems to match the string, but the captured groups are not what I'm looking for. I expect: NFPA 101 19 7 2 2 What I get is…
steventnorris
  • 5,656
  • 23
  • 93
  • 174
0
votes
1 answer

Removing text within parentheses and trailing spaces

I am using Rubular for this. I have the following string: summary = "Hi world. Hi world. Hi world. Hi world. Hi world. Hi world. Hi world. Hi world (this is here). Hi world Hi world (wow)." I'm trying to remove all parentheses from the string with…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
0
votes
2 answers

Regex issue with finding words partially

I have a regex that's working for some words but not all: str.scan(/typeaheadResult\(\{\"Q\":("\w+\s?\w+\s?\w+\s?\w+"),\"R\":\[+("\w+\s?\w+\s?\w+\s?\w+")/) The string that doesn't seem to be captured is below: if (typeof typeaheadResult !==…
Horse Voice
  • 8,138
  • 15
  • 69
  • 120
0
votes
2 answers

Regex: help to finish a regex in rubular

I need a help to finish a Perl Regex to the context below: [a-zA-Z:] ------------------------------------------ I have I need ------------------------------------------ > str(datasets::ris$) datasets::ris >…
jcfaria
  • 312
  • 3
  • 14
0
votes
2 answers

Help with regex / ruby

Hey guys, so I'm making a script to featch words/results off of this site (http://grecni.com/texttwist.php), So I already have the http request post ready, ect. Only thing I need now is to fetch out the words, So I'm working with an html source…
Rickmasta
  • 439
  • 1
  • 7
  • 16