Skip to content
Advertisement

Tag: regex

regex convert to object

I’m trying to get the value as regex as follow: But I can get the only single value such as “fixed-address” and “host2name”. In “domain-name-servers” I did with “,” in regex. But I think it isn’t the right way because the values are not same count. Could you help me to get the value of “domain-name-servers” and “domain-search” with right

Regex to get part of the string after dot and before hyphen?

I’m new to regex and have tried to get the regex expression in Python for the following string but still no luck. Just wondering if anyone know the best regex to get group1 from: Basically, I was trying to get the part of string after the first dot and before the second hyphen Answer You can just do it with

How to ensure that at least one of A and B sign appears in the regex?

I want to search the idx of sub-string that has 年, and at the same time, there must be digits(sign A) before 年 or [初末底前](sign B) behind “年”, for example,in s_l, it should return 4,5,0 One idea to divide the regex, like but it is too complex, other one is using (?=…) but I haven’t got the idea and how

Reading accounting information with regex

Context In my daily job I lost a lot of time putting values in excel from a balance sheet manually, so I start learning how to code in python to speed up my work. Problem I am trying to create a regex that is able to detect the value of one account and send me the money that the account

Regex Help for text/pattern between two keywords

I am trying to extract text between two words. The below pattern repeats itself with modifications in between ‘start keyword’ and ‘end keyword’ across the text document. The document has paragraphs and text before and after the following patterns, which i don’t want to extract. Can anyone help me with the regex for the following ? which would extract all

Python Regex to split a string opening and closing hours [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago. Improve this question I have a string which contains two shifts opening and closing time for each days of a week separated by

Extract subtring using regex python

Hello I have this string and I need extract from this some sub strings according some delimiters: And I need extract exactly this strings: I have tried a lot of types: re.findall, re.search, re.match. But I never geted the result expected. For eg: this code bellow print all string: Answer You do not need a regex for this, you may

Regex find hash comments exclude curly brackets

I want to find the hash comments that don’t contain the text inside curly braces. But if it starts with #, it’s all comments. Input: Output: I want to be able to achieve what I want with one line of regular expression. Currently I can only find all strings starting with # by {.*?}(*SKIP)(*F)|#[^#{}n].* However it doesn’t work in python(I

Advertisement