Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regular Expressions & make files

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> General Programming
General Programming  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Sep 05, 2006 8:41 am    Post subject: Regular Expressions & make files Reply with quote

Regular Expression Basics

"Regular expressions, sometimes referred to as regex, grep, or pattern
matching, can be a very powerful tool and a tremendous time-saver with a
broad range of application. As an extended form of find-and-replace, you
can use a regular expression to do things such as perform client-side
validation of email addresses and phone numbers, search multiple
documents for strings and patterns you wish to change or remove, or
extract a list of links from source code."


Last edited by delovski on Wed Oct 25, 2006 2:52 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Sep 05, 2006 8:44 am    Post subject: Reply with quote

Learning GNU Make Functions with Arithmetic

"GNU Make has no built-in arithmetic capability. In this article I present a
collection of GNU Make macros that implement functions for addition,
subtraction, multiplication, and division of integers. Functions are also
provided for integer comparisons such as “greater than” and “not equal.”
These macros are implemented entirely using GNU Make's built-in string
manipulation functions."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Oct 07, 2006 8:20 pm    Post subject: Reply with quote

Regular Expressions Cheat Sheet

"The Regular Expressions cheat sheet is designed to be printed on an A4
sheet of paper and live by a designer or developer's desk, to make life a bit
easier. A description of what is on the cheat sheet follows, or if you are
impatient, you can go straight to the full size Regular Expressions cheat
sheet."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Oct 25, 2006 2:51 pm    Post subject: Reply with quote

Digg: Debugging make

"make and utilities like it are fundamental tools for streamlining the
application build process. Learn the structure of the makefile, how to
avoid common mistakes in its creation, and how to solve or work around
portability issues and other problems as they crop up."
Back to top
View user's profile Send private message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Fri Nov 17, 2006 1:16 am    Post subject: Reply with quote

JoS: Anybody know of a really good beginner regexp tutorial?

"Regexp-coach looks cool... too bad they only have Macs."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Aug 22, 2007 8:48 pm    Post subject: Reply with quote

freshmeat: What is Wrong with Make?, by Adrian Neagu

"The first wrong thing is people's ignorance about Make's limitations with
respect to their requirements. I'll start my critique with a list of wrong beliefs
about this classic tool."
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Mon Dec 03, 2007 9:25 pm    Post subject: Reply with quote

How Regexes Work, by Mark-Jason Dominus

"This isn't an article about how to use regexes; you've probably seen plenty of
those already. It's about how you would write a regex package from scratch,
in a language like C that doesn't already have regexes."
Back to top
View user's profile Send private message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Sat Mar 29, 2008 8:06 pm    Post subject: Reply with quote

reddit - Generate regular expressions from some example test

"where has this been all my life?!"
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu May 01, 2008 1:18 am    Post subject: Reply with quote

Apple: Building Makefile Projects With Xcode

"Although Xcode keeps track of build settings in its own preferences files for
information beyond what could normally be maintained in a makefile, it can
also work closely with your project’s makefiles. If you want to use Xcode for
development in Mac OS X, you can include a makefile in a Xcode project as
follows..."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Thu May 01, 2008 4:21 pm    Post subject: Reply with quote

uf - C on Linux

"Here's a link for further reading: http://www.airs.com/ian/configure/

As for 'make' and 'make install', these both invoke the Makefile with the
latter statement specifically referencing the "install" entry point. Here's a
typical Makefile that could build the hello.c program I provided earlier."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon May 26, 2008 9:36 am    Post subject: Reply with quote

Make - a tutorial

"Make uses a special target, named .SUFFIXES to allow you to define your
own suffixes. For example, the dependency line:
.SUFFIXES: .foo .bar
tells make that you will be using these special suffixes to make your own rules. "
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Thu Aug 21, 2008 6:39 pm    Post subject: Reply with quote

What’s wrong with make?

"So what is wrong with it? I’m not complaining about the simple annoyances
like insane use of tabs or being based on two inflexible programming languages
(shell script and make macros). No, it’s got two fundamental problems: it cannot
enforce correct dependency tracking and its dependency language is insufficiently
expressive for common tasks."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Nov 02, 2009 8:58 pm    Post subject: Reply with quote

reddit - Trying qmake and CMake (as an autotools user)

"The problem with autotools is that it is used for complicated things, and
people cut-and-paste complicated things even when they ought to be si-
mple. 99% of people just need a way to access .pc files and generate ju-
icy Makefiles, the portability part is taken care by glib, sdl and so on."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jul 01, 2019 5:46 pm    Post subject: Reply with quote

so - Regex C code is not working on my mac osx

"I'm testing the following code on 4 Macbook. all Macbook are up to date with
10.8.4 on 3 of them it is working fine but not on my Macbook and I start be
crazy. I don't know what to do anymore."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Jul 16, 2021 12:54 pm    Post subject: Reply with quote

so - How to write a Makefile with separate source and header directories?

"Following this tutorial...

I have 2 source files and 1 header file. I want to have them in separate
directories like in the tutorial.

.
├── include
│ └── hellomake.h
├── Makefile
└── src
. ├── hellofunc.c
. └── hellomake.c

fatal error: no input files"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sat Jan 21, 2023 7:13 pm    Post subject: Reply with quote

so - Search through NSString using Regular Expression

Code:
NSString *yourString = @"";
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression         
    regularExpressionWithPattern:@"(NS|UI)+(\\w+)"
    options:NSRegularExpressionCaseInsensitive
    error:&error];
[regex enumerateMatchesInString:yourString options:0 range:NSMakeRange(0, [yourString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
    // your code to handle matches here
}];


https://regex101.com/r/uI8rR1/2

/^(?!0+\.0+$)\d{1,3}(?:,\d{3})*\.\d{2}$/
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sat Jan 21, 2023 7:46 pm    Post subject: Reply with quote

so - Search through NSString using Regular Expression

One simple way would be to validate the string using this regular expression:

Code:
^[$][0-9]+([.][0-9]{2})?$
^ ^   ^  ^  ^   ^   ^  ^^
| |   |  |  |   |   |  ||
| |   |  |  |   |   |  |+-- End-of-input marker
| |   |  |  |   |   |  +--- Optional
| |   |  |  |   |   +------ Repeated exactly two times
| |   |  |  |   +---------- A decimal digit
| |   |  |  +-------------- A dot (literal)
| |   |  +----------------- Repeated once or more
| |   +-------------------- A decimal digit
| +------------------------ The dollar sign (literal)
+-------------------------- Start-of-input marker

Here is a sample code that uses the above expression:

Code:
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression
    regularExpressionWithPattern:@"^[$][0-9]+([.][0-9]{2})?$"
                         options:NSRegularExpressionCaseInsensitive
                           error:&error];
if ([regex numberOfMatchesInString:@"$321.05" options:0 range:NSMakeRange(0, 7)]) {
    NSLog(@"Success");
}


>>> /([\d,.])*([kn|kuna|kune|eur|?|EUR| ])/g

>>> /([\d,.]*)(kn|kuna|eur|EUR|€)/g

>>> /([\d,.]*)(kn|kuna|eur|EUR|€| )/g
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Mar 12, 2023 8:57 pm    Post subject: Reply with quote

>> ^\d{1,3}(?:.\d{3})*\,\d{2}$

>> ^\d{1,3}(?:.\d{3})*\,\d{2}

Tada:

^\d{1,3}(?:.\d{3})*\,\d{2}.*(EUR|KN|kn|Kn|Kuna|Kune|Eur)?
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Tue Feb 13, 2024 7:10 pm    Post subject: Reply with quote

r - Learning GNU make?

https://www.gnu.org/software/make/manual/html_node/index.html

There is a free book: https://www.oreilly.com/openbook/make3/book/index.csp

It's published in 2004, but things have not changed with GNU Make

After you figure out GNU Make, look into Autotools: https://autotools.info/

https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html

https://makefiletutorial.com

newzenler.com - GNU make and Makefile from Scratch
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> General Programming All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group