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

VB Net RegEx Match Multiple
Invalid Escape Character in Regex for html 5 Input Validation
Regex to match start and end line [duplicate]
How to handle “cannot refer to an open group at position” in Python?
How to format the output of a grep with a regex pattern to match between a string and character
Regular expression to match a line containing only the list of words
How do I create a regex for 2 different patterns that outputs in 1 group, in Google sheets?
Replacing a string in between known strings over mutiple lines in Powershell
Data Preperation Identify String using Regex and move to new column
Regular expressions - optional brackets
ICU Regex matching for non-digit and no whitespace
Seemingly incorrect regex evaluation in regexp_replace
How to detect a string which does not include " using flex?
Extract certain values from string in .txt files with PowerShell
Apache 301 Redirect Add language prefix if not present
Regex, match characters and doesn't contain more than one _ followed by another _

Categories

HOME
validation
html5-canvas
codeigniter
wpf
printing
sqlite
jsonschema
weight
windows-runtime
format
webdriver-io
build.gradle
wget
asp.net-mvc-3
range
jena
binary-search
struts2-jquery
scope
sonata-admin
spring-boot-admin
atmelstudio
org-mode
centroid
mlr
sencha-touch-2
line-breaks
urlrewriter.net
ssms-2014
jcrop
bitcode
esri
typemock-isolator
expression-trees
operator-keyword
asana-api
nest-thermostat
webcenter
capstone
haxm
extraction
paypal-rest-sdk
ecdsa
texture-mapping
mindstorms
hawkular
codeigniter-hmvc
adal.js
vega-lite
html-form
federation
smartbanner
python-module
itertools
sizing
cabal-install
sqlite-net
gwt-material-design
evaluate
business-logic
visual-build-professional
webpack-hmr
mutation
rabbitvcs
clipping
interpreted-language
hypervisor
wss4j
pencilblue
physx
sendto
spread-toolkit
nitrogen
short
mydbr
xml.modify
pydatalog
deap
re2c
siblings
apache-commons-dbcp
floating-point-conversion
emacs-jedi
git-gui
12factor
cakephp-2.1
oncreate
cocosbuilder
libavg
onmouseout
freeglut
adaboost
android-assets
closest
textboxlist
emacs-ecb
having
apache-config
scramble

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