Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex: positive lookbehind
#1
Hi

I am new to Python. I have used regex in Uipath but when I transferred my regex expression to Python it doesn't seem to work. I get error "NoneType object has no attribute 'group'", which mean a match is not found.

But my regex expression works fine in Uipath.

 text_lines=f.readlines()
       model_regex=re.compile(r'(?<=model choice :).*')
       model=model_regex.search('text_lines')
       #print(text_lines)
       print(model.group()) 
1) do I have to place my variable (text_line) in quotation marks here?

model=model_regex.search('text_lines')
2) I basically open a csv file and read it all the text using
text_lines=f.readlines()
But will text_lines look exactly like in the csv file? I noted when I use print text_lines look jumbled up.

3) Is there a way to read in text_lines to look exactly like in the csv files so that my regex expression work?

Thank you
Reply


Messages In This Thread
Regex: positive lookbehind - by Secret - Sep-19-2020, 10:36 AM
RE: Regex: positive lookbehind - by scidam - Sep-20-2020, 11:54 PM
RE: Regex: positive lookbehind - by snippsat - Sep-21-2020, 12:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Positive integral solutions for Linear Diophantine Equation august 4 1,333 Jan-13-2023, 09:48 PM
Last Post: Gribouillis
  How to do bar graph with positive and negative values different colors? Mark17 1 5,420 Jun-10-2022, 07:38 PM
Last Post: Mark17
  Positive to negative bernardoB 6 4,530 Mar-13-2019, 07:39 PM
Last Post: bernardoB
  negative to positive slices Skaperen 3 3,742 Jan-29-2018, 05:47 AM
Last Post: Skaperen
  How to find any non positive integer noob 3 4,153 Apr-27-2017, 04:46 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020