FAQ Database Discussion Community


python regex match case option

python,regex,findall,ignore-case
I would like to utilize a match case option. I have a piece of code to search a string in a list. I guess there is a more elegant way to do the same. searchString = "maki" itemList = ["Maki", "moki", "maki", "Muki", "Moki"] resultList = [] matchCase = 0...

Grails findAll closure combine query with hasmany field

grails,groovy,gorm,findall
As per the below Domain Classes VisitSchedules{ Visit visit static hasMany = [users: User] ... } Visit{ DateTime startTime ... } I want to query VisitSchedules for visits that are scheduled for a future date for the user. something like below def upcomingVisitSchedules = VisitSchedules.findAll { visit.startTime >= new DateTime()...

Using method FindAll in two generic lists

vb.net,generic-list,findall
I've got two generic lists in a vb.net program. I'd like to loop List_A and search List_A.ID in List_B, elements in common should be stored in a third list (LIST). For Each n As BE_Busq In List_A LIST = List_B.FindAll(Function(x As BE_Busq) x.ID = n.ID) '' for each step, LIST...

Regular expression OR in python findall

python,regex,findall
I am trying to use the regualr expression re.findall("void (D|S)TC_.+\(\)", testCaseFile) My expectation is the above expression returns list void DTC_Sample_01() void STC_Sample_02() But it should ignore void ZTC_Sample_03() or any other. But it is not working as expected...

Finding all solutions in prolog

prolog,findall
In prolog I'm trying to unify every valid pairing of needs with resources needs([ece2090,1,m,13,16]). needs([ece3520,1,tu,11,14]). needs([ece4420,1,w,13,16]). resources([joel, [ece2090,ece2010,ece3520,ece4420],[[m,13,16]]]). resources([sam, [ece2010,ece4420],[]]). resources([pete, [ece3520],[[w,13,16]]]). using this formula make_bid([Class,Sect,Day,Ts,Te],[Name,Cap,Unavail],[Class,Sect,Day,Ts,Te,Name,_]) :- no_conflict_all_unavailable(Day,Ts,Te,Unavail), course_capable(Class,Cap), writef('%w %w %w\n',[Class,Sect,Name]), fail....

chunk of data into fixed lengths chunks and then add a space and again add them all as a string

regex,list,join,ironpython,findall
I have got hex values as a85b080040010000. I want it to be as a8 5b 08 00 40 01 00 00. I have done it by using below code. But I have to work with very large data. So I want computed time to be very low. import binascii import...

Using regex to match sentences that may include quote marks “”

python,regex,python-3.x,findall
I've been trying for a few days now to write a regex that will capture sentences that start with a particular string, and end with a dissallowed character (<). This sentence may contain any punctuation (off the top of my head []()-,.!?\/) and most importantly ' and ", however always...

Python findall, regex, unicode

python,regex,unicode,findall
I'm trying to write a Python script that searches thru a directory tree and lists all .flac files and derives Arist, Album and Title from resp. dir/subdir/filename and write that to a file. The code works fine, until it hits a unicode character. Here's the code: import os, glob, re...

How can I use regex in Python to return these numbers?

python,regex,findall
I have the following code stored as a string variable in Python. How can I use regex, along with re.findall('', text), to parse out the five 9-digit numbers (all starting with "305...") under "attributeLookup" lookup in the below code? var PRO_META_JSON = { "attributeDefinition":{ "defaultSku":305557121, "attributeListing":[{ "label":"Finish", "defaultIndex":0, "options":[ "White::f33b4086",...

How to Get List of Classes where string Property is null or Empty string value?

c#,asp.net,findall
I have a class called, Header, and within another Class, called Home, I create a List<Header>, called HeaderList, which works fine and gathers the List of Headers that are needed. The Header class has a property called, MobileImage that I would like to get within another List where all MobileImage...

How does this code work to extract URL's from a string with regex

python,regex,python-3.x,string-parsing,findall
I'm using a snippet i found on stackexchange that finds all url's in a string, using re.findall(). It works perfectly, however to further my knowledge I would like to know how exactly it works. The code is as follows- re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[[email protected]&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', site) As far as i understand, its finding all strings...

How to get the hidden input's value by using python?

python,python-2.7,urllib2,findall
How can i get input value from html page like <input type="hidden" name="captId" value="AqXpRsh3s9QHfxUb6r4b7uOWqMT" ng-model="captId"> I have input name [ name="captId" ] and need his value import re , urllib , urllib2 a = urllib2.urlopen('http://www.example.com/','').read() thanx update 1 I installed BeautifulSoup and used it but there some errors code import...

How to make Python's findall regular expression method inclusive

python,regex,findall
I have a string that looks as follows. s = 'string with %%substring1%% and %%substring2%%' I want to extract the text in the substrings including the %% and I cannot figure out how to make a regular expression inclusive. For example, re.findall('%%(.*?)%%', s, re.DOTALL) will output ['substring1', 'substring2'], but what...

Grails - findAll joining two tables

grails,gorm,findall
I'm new to Grails. I'm having problem with retrieving data from DB. I have domains with classes, something like... class Lightbox { String name = '' String link = '' static hasMany = [users: LightboxUserAccount] } class LightboxUserAccount { UserAccount userAccount static belongsTo = [lightbox: Lightbox] } class UserAccount {...

Catch multiple string occurrences in multiline text

python,regex,string,findall
Iv'e been at it for some time now, I'm trying to extract a number of values from a string pattern in a multiline text using re.findall with no luck. text: RX[0] qpn : 0x48 cqn : 0x80 rxBytes : 179531811 rxPackets : 296242 rxPacketsDropped : 0 rxCheckSumOk : 225257 rxCheckSumNone...

findAll on non object in extbase

repository,extbase,findall,typo3-4.5
I just created an extension in typo3 4.5 with one model (product). I created the "productRepository" then injected it in the ProductController but I still get the Call to a member function findAll() on a non-object here is how the ProductController looks like : /** * @var Tx_PiProductDetail_Domain_Repository_ProductRepository */ protected...