regex


Extracting the return value in Squeak (SmallTalk)


I want to extract the return value from a given text that represent a method.
for example:
g: x and: y
Transcript show: x; show: y.
^x+y.
so to solve I used the regular expression:
\^\s*(\w+.*).
when I run this on some regex websites it seems to work and do what I want, for example : https://regex101.com/
but when I run the following program it seems that squeak return nil to it (can't find a match). I suspect that is because I am using the character ^.
but I escaped that character so I have no idea why that is failing to work.
the code I used to test it:
|aString regexObj |
aString := 'g: x and: y
Transcript show: x; show: y.
^x+y.'.
regexObj := '\^\s*(\w+.*).' asRegex.
regexObj matches: aString.
returnedType:= (regexObj subexpression:2).
Transcript show: returnedType.
anyone knows why, and how to solve it?
,Thanks.

Related Links

Find file paths that have spaces
How to extract all (finite) possible strings from regex?
regular expression for subnet of ip address
Add parameter to URL using .htaccess
Retrieve string between two string delimiters using regex in perl
regex to break all chars between matching criteria
Date format conversion in Perl
Divide cell in excel by 3 different string patterns using vba
Why does a space break validation here?
Parsing numbers in a text using regexp MATLAB
Dmesg command piping it to grep
How to combine two regex's
How to delete string if it contains specific character using regex in perl?
Slash before # when linking with href=“#”
word separated with single space character from bash output
Powershell Get-ADOrganizationalUnit Regex

Categories

HOME
ffmpeg
simulated-annealing
office-js
compiler-errors
appium-ios
garbage-collection
turing
api.ai
visual-studio-2012
gluon
mvvm-light
classloader
autofac
clion
silverlight
tcplistener
copy-paste
light-inject
uwsgi
sparkpost
pouchdb
axure
lighttpd
scale
servlet-filters
h.264
lexikjwtauthbundle
textmatebundles
jmeter-plugins
microphone
ratchet-2
angular-services
debugview
jsplumb
kubernetes-go-client
scom
background-process
stackexchange.exceptional
spring-websocket
api-doc
msal
apartment-gem
amazon-elasticsearch
windows-scripting
visualsvn-server
word-embedding
google-slides
tern
hostname
freerdp
backwards-compatibility
php-deployer
pci
zuul
ewsjavaapi
simplesamlphp
ctl
okular
database-cleaner
simple.odata.client
ios-app-group
libev
paypal-webhooks
jce
angular-directive
android-sdk-tools
jsbin
vb4android
post-increment
ocsp
webclient-download
securesocial
cover
aplpy
screen-capture
win32com
laravel-forge
readline
json4s
protected
avalonedit
cordova-cli
zim-database
getuikit
gcovr
misra
cvs2git
django-postgresql
publish-actions
cpp-netlib
before-save
clearcase-remote-client
django-supervisor
xml.modify
modx-evolution
pligg
gora
asp.net-authentication
uptime
libavg
android-actionbar-compat
jsr223
cellphone
pong
nscollectionviewitem
custom-tag
noaa
spquery
n900
contracts

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App