Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
preg_match_all
- Page 1
Question Answering with YouTube Videos Using RAG in LangChain
Programming
Computer Science
6 Days Ago
by usmanmalik57
In previous articles, I explained how to use natural language to interact with [PDF documents](https://www.daniweb.com/programming/computer-science/tutorials/541732/paris-olympics-ticket-information-chatbot-with-memory-using-langchain) and [SQL databases](https://www.daniweb.com/programming/computer-science/tutorials/541771/using-natural-language-…
Re: Backlink Indexing issue
Digital Media
Digital Marketing
Search Engine Strategies
1 Day Ago
by Dani
Make sure the backlinks are on pages that are not noindexed (they neither have a meta noindex tag nor a noindex http header), as well as the pages’ URLs not matching any rule on their website’s robots.txt file. Additionally, make sure that the page on your own website the backlink points to doesn’t match a rule on your site’s own robots.txt …
Re: How to query database using variable and get all results not just one row
Programming
Web Development
1 Week Ago
by Chris_103
To retrieve all records associated with the current user, you can use the fetchAll() method instead of fetch(). Here's how you can modify your code: ```php // Query database to retrieve records associated with the user $sql = "SELECT * FROM table_name WHERE variable_name = :variable_name"; $stmt = $conn->prepare($sql); $stmt->…
Extracting values from a regex match
Programming
Software Development
2 Months Ago
by Tom_45
I am trying to extract three values from the td tags in an html downloaded file. <tr align="right"><td>236</td><td>Roy</td><td>Allyson</td> <tr align="right"><td>237</td><td>Marvin</td><td>Pamela</td> <tr align="right"><td…
Why am getting different syntax errors when running a Python script
Programming
Software Development
2 Months Ago
by Tom_45
I am working on an exercise from Google's Python class dealing with popular baby names. I have the program running properly when using only one filename, but when I try to use the wildcard to get all files with baby####.html files I get differing errors every time I run the program. Here is the problem code: matches = re.findall('<…
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by AndreRet
Your main issue is with the way you're trying to capture the values inside the 'td' tags. Also, you should consider using non-greedy quantifiers - [Minimal or non-greedy quantifiers](Regular expressions are generally considered greedy because an expression with repetitions will attempt to match as many characters as possible. The asterisk (*), plus…
Converting PDF Image to CSV Using Multimodal Google Gemini Pro
Programming
Computer Science
2 Months Ago
by usmanmalik57
In this article, you will learn to use [Google Gemini Pro](https://blog.google/technology/ai/google-gemini-ai/), a state-of-the-art multimodal generative model, to extract information from PDF and convert it to CSV files. You will use a simple text prompt to tell Google Gemini Pro about the information you want to extract. This is a valuable skill …
PDF Image Table Extractor Web App with Google Gemini Pro and Streamlit
Programming
Computer Science
2 Months Ago
by usmanmalik57
In my previous article, I explained [how to convert PDF image to CSV using Multimodal Google Gemini Pro](https://www.daniweb.com/programming/computer-science/tutorials/541365/converting-pdf-image-to-csv-using-multimodal-google-gemini-pro). To do so, I wrote a Python script that passes text command to [Google Gemino Pro](https://blog.google/…
Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Tom_45
I am trying to extract three values from the td tags in an html downloaded file. <tr align="right"><td>236</td><td>Roy</td><td>Allyson</td> <tr align="right"><td>237</td><td>Marvin</td><td>Pamela</td> <tr align="right"><td…
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Reverend Jim
For html = '<tr align="right"><td>236</td><td>Roy</td><td>Allyson</td>' pat = '<td>(.+?)</td>' then re.split(pat,html) returns ['<tr align="right">', '236', '', 'Roy', '', 'Allyson', ''] and re.split(pat,html)[1::2] will …
Re: Extracting values from a regex match
Programming
Software Development
2 Months Ago
by Reverend Jim
The trick is to use lazy matching which matches the shortest possible string. html = '<tr align="right"><td>236</td><td>Roy</td><td>Allyson</td>' pat = '<td>(.+?)</td>' then re.split(pat,html) returns ['<tr align="right">', '236', …
Re: Extracting values from a regex match
Programming
Software Development
2 Months Ago
by pritaeas
Sidenote: If you want to learn, understand and experiment with regexes I can highly recommend RegexBuddy.
Re: Extracting values from a regex match
Programming
Software Development
2 Months Ago
by Reverend Jim
Also [autoregex](https://www.autoregex.xyz/)
Re: Extracting values from a regex match
Programming
Software Development
2 Months Ago
by AndreRet
Same question, different post - [Extracting values from capturing groups in rege](https://www.daniweb.com/programming/software-development/threads/541420/extracting-values-from-capturing-groups-in-regex)
Re: Extracting values from a regex match
Programming
Software Development
1 Month Ago
by Tom_45
Question has been answered. The correct pattern is: matches = re.findall(r'<td>(\d+)+<\/td><td>(\w+)<\/td><td>(\w+)', file)
Re: Why am getting different syntax errors when running a Python script
Programming
Software Development
2 Months Ago
by Tom_45
After I posted this question I noticed that I was missing the raw string indicator and the capture group enclosing parenthesis on the findall, which explains the subscripting error. So, hold off on the answers for now. I'm still having other issues with multiple file runs, though.
Re: Why am getting different syntax errors when running a Python script
Programming
Software Development
2 Months Ago
by Tom_45
Finished the assignment and was able to work out the bugs I was encountering. In addition to the issues I mentioned in my last reply, I had several instances of not indenting properly so that statements like exit() were not executing because their indention made them part of an if statement.
Re: Track Faces from Videos with Margins Using Deep Learning in Python
Programming
Computer Science
2 Months Ago
by EdwardMatthew
It's fantastic, I have read this article and it is super amazing. thankyou for the knowledge.
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Tom_45
I'm not getting the results you presented, I'm getting the whole file not just the tr tags. The tr tags I used was just a subset of the entire file.
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Reverend Jim
Just process the file line by line and apply the regular expression to particular lines. I can't give you an expression that matches only the lines you showed me with a guarantee that in matches nothing else without seeing the entire file.
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Reverend Jim
You can either read the entire file into a list, then filter that list, or you could process it line by line and process each matching line. For example (using my file) for line in open('usblog.txt'): if '2024-01-24' in line: print(line) or text = open('usblog.txt').readlines() for line in [x for x in text if…
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Tom_45
It's a long one, but here it is. <head><title>Popular Baby Names</title> <meta name="dc.language" scheme="ISO639-2" content="eng"> <meta name="dc.creator" content="OACT"> <meta name="lead_content_manager" content="JeffK"&…
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Reverend Jim
Try import re pat = '<td>(.+?)</td>' for line in open('yourfile.html'): if line.startswith('<tr align="right"><td>'): print(re.findall(pat,line)) I realized that findall is cleaner than split. You might want to have a look at [this regex online tool](https://www…
Re: Extracting values from capturing groups in regex
Programming
Software Development
2 Months Ago
by Tom_45
Issue resolved
Preg match and replace for img urls
Programming
Web Development
15 Years Ago
by ade92uk
… = 0, $size = sizeof($matches[0]); $i < $size; ++$i) { $imgurl =
preg_match_all
('#http:\/\/#si', $matches[0][$i], $matches); if ($imgurl = true) {break…
help with preg match
Programming
Web Development
16 Years Ago
by realnsleo
hi...i want to use the preg match function to verify a string that should have the format format of a year - two digits - two letters - two digits, like this: [in]2005-03-IT-031[/in] thanks
possible to layer preg match?
Programming
Web Development
13 Years Ago
by andrewliu
…;\/form\>.*?\<\/div\>/is", $res[1], $bycontainer );
preg_match_all
("/\<h2>\s*(\<div.*?\<\/div>…;\s*)?(.*?)\<\/h2\>/is", $bycontainer[0], $level1 );
preg_match_all
("/\<div class=\"thumbWrapper\"\>(.*?)\<\/div…
Re: Regular expression match
Programming
Web Development
12 Years Ago
by subrata_ushasi
Hi, I think this link will help you. [url]http://php.net/manual/en/function.preg-match.php[/url]
Search for an exact match
Programming
Web Development
14 Years Ago
by tulipputih
Hello, anybody can suggest me on how to do exact match in php ( for search purpose). From my reading I understand that we need to use " ". What is the correct syntax for this? Is preg-match important here. Thank you.
Re: preg_match - where do I err?
Programming
Web Development
12 Years Ago
by Stefano Mtangoo
[QUOTE=Insensus;1589326][code]$regex = '/^[0-9]{5,}\/[a-zA-Z]\.[0-9]{2,}$/';[/code][/QUOTE] Thanks a lot, someone answered [URL="http://stackoverflow.com/questions/6472339/preg-match-where-do-i-err"]here[/URL]. Can I know why is / escaped? I thought only \ is escaped :-O Also doe these two differ as far as regex is concerned? [code]$…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC