1
vote
2answers
48 views

python regex and replace

I am trying to learn python and regex at the same time and I am having some trouble in finding how to match till end of string and make a replacement on the fly. So, I have a string like so: ...
0
votes
1answer
27 views

How to change the word order of phrasal verbs in a POS-tagged corpus file

I have a POS-tagged parallel corpus text file in which I would like to do word reordering, so that the "separable phrasal verb particle" will appear next to the "verb" of the phrasal verb ('make up a ...
3
votes
1answer
77 views

Python 3 Regex Last Match

How do I grab the 123 part of the following string using Python 3 regex module? ....XX (a lot of HTML characters)123 Here the ... Part denotes a long string consisting of HTML characters, words and ...
0
votes
1answer
34 views

Making a dictionary where values are based off of a regex - Python

Say I have a dictionary x = {'123A......': None, '123AA.....': None, '123AB.....': None} Assume I also have a list y = ['123AC.....', '123ABB....', '123ABC....'] what I want is the following ...
2
votes
1answer
26 views

Include '-' in regex search with \w+ . Python

k = 'a bunch of data and then name ""Serpin-ps""' print re.search(r'name\s""(\w+)""',k).group(1) gives: AttributeError: 'NoneType' object has no attribute 'group' desired_output = ...
1
vote
3answers
34 views

trying to find text with wild card integers inside a string in a special format in Python

I have a piece of code that opens a file and iterates each line inside the formated text file there will be a piece of text like this: name.x00y00.whatever I searching for the x00y00 to see if ...
2
votes
2answers
61 views

Optional regex groups for comic book titles (python)

I am trying to extract relevant information from multiple comic book titles with varying content. However, there are only about 5 or 6 different patterns that are followed: Examples are: Green ...
0
votes
2answers
54 views

Using Regex to Find and Replace

I would like to take a text document that contains Feet+Frames values and convert them to Timecodes. For example, 0000+00 is replaced with 00:00:00:00. I have a function to do the conversion from ...
0
votes
2answers
48 views

Int() Conversions not working right in python

So I'm making a python Module to create and save data for an in-game character. the the class is Character and goes as follows: #!/usr/bin/python import os import re class Character: storage = ...
0
votes
1answer
46 views

Escape sequences vs predefined character classes (aka special regex characters) when encapsulated by double quotes

Perl, like Java and Python, has \s, the special regex character that matches whitespace, in addition to other special characters. In Perl, the following would not be valid: my $sentence = "The ...
1
vote
2answers
46 views

identifying position of the pattern match

I need to find the exact position where the string matched.. >>> pattern = 'Test.*1' >>> str1='Testworld1' >>> match = re.search(pattern,str1) >>> match.group() ...
2
votes
2answers
48 views

Python regex: how to match strings that DO NOT contain an *exact* sentence?

I want to filter out messages from a log file that contain e.g. the sentence This is message 12345. Ignore. If I would use grep, I could simple pass the sentence and use the -v switch, for example: ...
3
votes
4answers
101 views

What's the best way to split a string into integer part and string part?

I am having a string like this "11547QSD". I would like to split it in to 2 parts "11547" and "QSD". I got a hint with isnumeric() function. I am placing a overview down.Please suggest me a best way ...
2
votes
4answers
48 views

Regex to match possible names from a string

I want to match possible names from a string. A name should be 2-4 words, each with 3 or more letters, all words capitalized. For example, given this list of strings: Her name is Emily. I work for ...
1
vote
3answers
35 views

Extract digit characters after occurrence?

I have a string and I want to extract the exon_number which is inbetween ""X"" two parenthesis I use re.search to find the occurrence of 'exon_number' but I do not want to include the string ...

1 2 3 4 5 311
15 30 50 per page