Linked Questions

47 votes
6 answers
189k views

I need a python regular expression to check if a word is present in a string. The string is separated by commas, potentially. So for example, line = 'This,is,a,sample,string' I want to search based ...
Zack's user avatar
  • 14k
0 votes
1 answer
2k views

I am trying to remove tags in text that are identified by a backslash. For example, for the phrase 'Hello \tag world', I'd like to return the phrase 'Hello world'. I've tried the following but it ...
myname's user avatar
  • 1,347
-1 votes
1 answer
565 views

This is the code in question: url(r'^dreamreals/', ListView.as_view(model = Dreamreal, template_name = "dreamreal_list.html")), )
Rajnish Kumar's user avatar
-1 votes
1 answer
197 views

I had thought the 'r' prefix in the pattern is to make sure that anything in the pattern will be interpreted as string literal, so that I don't have to use escape, but in this case below, I still have ...
marlon's user avatar
  • 7,929
0 votes
1 answer
100 views

So I am practicing data wrangling and I have encountered an issue. food['GPA'].unique() And the output is array(['2.4', '3.654', '3.3', '3.2', '3.5', '2.25', '3.8', '3.904', '3.4', '3.6', '3.1'...
Sjaikisan's user avatar
0 votes
0 answers
97 views

I'm getting error "error: bad escape \d at position 1" when working on date formatting. I have to convert from format 11/13.2015 to 11/13/2015. I'm replacing using a regex and converting to ...
Nani's user avatar
  • 1
0 votes
0 answers
70 views

I have this text: a href="#" class="s-navigation--item js-gps-track js-products-menu" aria-controls="products-popover" data-controller="s-popover" data-action=&...
RifloSnake's user avatar
0 votes
0 answers
51 views

Using the re library my problem is in this line x = re.match("([A-Z]:|home∼|\.\.?)\\", txt) Im trying to get a match with a disk "E:", "home∼", or a parent folder ".....
Dorknob78's user avatar
0 votes
0 answers
44 views

I have a fairly simple regular expression pattern that I'm trying to match with some raw string literals. I've tested the pattern here (https://regex101.com/r/xT6xU8/2) and it works perfectly, but in ...
Try431's user avatar
  • 247
0 votes
0 answers
38 views

my_address = re.search(rb'\x80\xC9.{4}\x94\x12\x8A\x41\x08', bytes).start() + 5 Read the doc but I'm a bit confused. My guess is \x80\xC9\BYTE\BYTE\BYTE\BYTE\BYTE\x94\x12\x8A\x41\x08\BYTE\BYTE\BYTE\...
joshgallantt's user avatar
0 votes
0 answers
32 views

I dont understand why my string is not matching : re.findall('\bbp\b', 'station bp coucou') According to regex101 it should match ...
LCMa's user avatar
  • 455
417 votes
19 answers
1.1m views

I need to remove all special characters, punctuation and spaces from a string so that I only have letters and numbers.
user664546's user avatar
  • 5,111
924 votes
8 answers
809k views

While asking this question, I realized I didn't know much about raw strings. For somebody claiming to be a Django trainer, this sucks. I know what an encoding is, and I know what u'' alone does since ...
Bite code's user avatar
  • 601k
375 votes
5 answers
277k views

I want to use input from a user as a regex pattern for a search over some text. It works, but how I can handle cases where user puts characters that have meaning in regex? For example, the user wants ...
MichaelT's user avatar
  • 7,954
15 votes
3 answers
9k views

I don't understand the logic in the functioning of the scape operator \ in python regex together with r' of raw strings. Some help is appreciated. code: import re text=' esto .es 10 . er - 12 .23 ...
JFerro's user avatar
  • 3,553

15 30 50 per page